[Freeswitch-dev] ESL Ruby/Lua extensions build/linking error

Philip.Pirozhkov at ontarget-group.com Philip.Pirozhkov at ontarget-group.com
Wed Apr 11 17:34:49 MSD 2012


Sorry for being stupid and confusing everyone, ESL luamod builds fine.
But ESL rubymod build from mainline fails, and my patch fixes that. It  
would be very nice to apply it upstream.

BR, Phil

Quoting Philip.Pirozhkov at ontarget-group.com:

> Quoting Philip.Pirozhkov at ontarget-group.com:
>
> I've figured out how to fix esl rubymod build for both Ruby 1.9 and 1.8
> Patch attached.
>
> BR, Phil
>
>>
>> BR, Phil
>>
>> Quoting Philip.Pirozhkov at ontarget-group.com:
>>
>>>
>>> Patch attached.
>>> I've removed esl_wrap.cpp here since it can always be recreated by swig.
>>>
>>> BR, Phil
>>>
>>> Quoting Philip.Pirozhkov at ontarget-group.com:
>>>
>>>> Ok, I screwed up a bit and forgot to call ./configure. But its output
>>>> makes me sad:
>>>> freeswitch]$ ./configuregit format-patch -o .      
>>>> 6f87ac55d6db945f7004b528ef8cb0f3e6c0c6f9
>>>> configure: error: cannot find install-sh, install.sh, or shtool in
>>>> build/config "."/build/config
>>>>
>>>> Ok, forget it and let's get back to libs/esl and run
>>>> make rubymod
>>>>
>>>> And here we go, ESL.so is finally here!
>>>>
>>>>
>>>> I'll generalise ruby 1.8/1.9 path configuration and will attach a patch.
>>>>
>>>> BR, Phil
>>>>
>>>> Quoting Philip.Pirozhkov at ontarget-group.com:
>>>>
>>>>> Okay, I've figured out how to point ld to these ruby libs, and the
>>>>> error is completely different and it's related to missing ESL.so we are
>>>>> referring to in these buildfiles.
>>>>>
>>>>>
>>>>> So, aside from all these makefile patches:
>>>>>
>>>>> 1. Output of autoconf:
>>>>> freeswitch]$ autoconf
>>>>> configure.in:122: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call
>>>>> detected in body
>>>>> ../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
>>>>> ../../lib/autoconf/general.m4:2591: _AC_COMPILE_IFELSE is   
>>>>> expanded from...
>>>>> ../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
>>>>> ../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
>>>>> ../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
>>>>> ../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
>>>>> configure.in:122: the top level
>>>>> configure.in:16: error: possibly undefined macro: AM_INIT_AUTOMAKE
>>>>>   If this token and others are legitimate, please use m4_pattern_allow.
>>>>>   See the Autoconf documentation.
>>>>> configure.in:140: error: possibly undefined macro: AM_PROG_CC_C_O
>>>>> configure.in:141: error: possibly undefined macro: AC_PROG_LIBTOOL
>>>>> configure.in:356: error: possibly undefined macro: AM_CONDITIONAL
>>>>>
>>>>> 2. Output of automake http://pastebin.com/XFFkNxVg
>>>>>
>>>>> Or can anybody send me an ESL.so please?
>>>>>
>>>>> BR, Phil
>>>>>
>>>>>
>>>>> Quoting Philip.Pirozhkov at ontarget-group.com:
>>>>>
>>>>>> Forgot to mention I'm using latest stable Ruby 1.9.3-p0
>>>>>> Seems that LOCAL_LDFLAGS is not getting what it expected to,   
>>>>>> the   result is
>>>>>> "-lpthread -lrt -ldl -lcrypt -lm", while it's expecting to get a ruby
>>>>>> lib dir, prefix it with "-L" and go. But fixing that doesn't help also.
>>>>>>
>>>>>> I've tried with Ruby 1.8.7 (with -I and -L patches to makefile only):
>>>>>>
>>>>>> ruby]$ make
>>>>>> swig -module ESL -ruby -c++ -DMULTIPLICITY -I../src/include -o
>>>>>> esl_wrap.cpp ../ESL.i
>>>>>> g++   -I/home/pirj/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-linux
>>>>>> -I../src/include -c esl_wrap.cpp -o esl_wrap.o
>>>>>> g++  esl_wrap.o  -L/home/pirj/.rvm/rubies/ruby-1.8.7-p352/lib   
>>>>>> -o    ESL.so -L.
>>>>>> /usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../crt1.o: In     
>>>>>> function   `_start':
>>>>>> (.text+0x18): undefined reference to `main'
>>>>>> esl_wrap.o: In function `rb_class_of':
>>>>>> esl_wrap.cpp:(.text+0x9e3): undefined reference to `rb_cFixnum'
>>>>>> esl_wrap.cpp:(.text+0x9f0): undefined reference to `rb_cNilClass'
>>>>>> esl_wrap.cpp:(.text+0x9fd): undefined reference to `rb_cFalseClass'
>>>>>> ...
>>>>>>
>>>>>>
>>>>>> P.S. ArchLinux, kernel 3.2.14, gcc 4.7.0, SWIG 2.0.4, ld 2.22.0
>>>>>>
>>>>>> Any hints?
>>>>>>
>>>>>> BR, Phil
>>>>>>
>>>>>> Quoting Philip.Pirozhkov at ontarget-group.com:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> Trying to build ruby and lua extensions from freeswitch/libs/esl:
>>>>>>> lua]$ make
>>>>>>> g++    -Wno-unused-function -c esl_wrap.cpp -o esl_wrap.o
>>>>>>> esl_wrap.cpp:1510:17: fatal error: esl.h: No such file or directory
>>>>>>> compilation terminated.
>>>>>>> make: *** [esl_wrap.o] Error 1
>>>>>>>
>>>>>>> this can be fixed adding
>>>>>>> -I../src/include to esl_wrap.o task
>>>>>>>
>>>>>>> but has ld error then:
>>>>>>> lua]$ make
>>>>>>> g++    -Wno-unused-function -I../src/include -c esl_wrap.cpp   
>>>>>>> -o    esl_wrap.o
>>>>>>> g++  esl_wrap.o  -llua -lpthread -o ESL.so -L.
>>>>>>> /usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../crt1.o: In       
>>>>>>> function   `_start':
>>>>>>> (.text+0x18): undefined reference to `main'
>>>>>>> esl_wrap.o: In function `_wrap_new_ESLevent__SWIG_0':
>>>>>>> esl_wrap.cpp:(.text+0x3974): undefined reference to
>>>>>>> `ESLevent::ESLevent(char const*, char const*)'
>>>>>>> esl_wrap.o: In function `_wrap_new_ESLevent__SWIG_1':
>>>>>>> ... (tl;dr)
>>>>>>>
>>>>>>>
>>>>>>> Same with ruby (even worse), it was failing to find ruby.h and
>>>>>>> ruby/config.h. I got make esl_wrap.cpp task fixed
>>>>>>> http://pastebin.com/uKFBZVF3
>>>>>>>
>>>>>>> but there's an ld error again:
>>>>>>>
>>>>>>> $ make
>>>>>>> g++  esl_wrap.o  -lpthread -lrt -ldl -lcrypt -lm   -L.  -rdynamic
>>>>>>> -Wl,-export-dynamic -o ESL.so -L.
>>>>>>> /usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../crt1.o: In       
>>>>>>> function   `_start':
>>>>>>> (.text+0x18): undefined reference to `main'
>>>>>>> esl_wrap.o: In function `rb_class_of':
>>>>>>> esl_wrap.cpp:(.text+0x9ed): undefined reference to `rb_cFixnum'
>>>>>>> esl_wrap.cpp:(.text+0x9fa): undefined reference to `rb_cTrueClass'
>>>>>>>
>>>>>>> Anyone successful with this stuff?
>>>>>>> I'm not experienced with GCC stuff at all.
>>>>>>> It would be very nice to pack this Ruby ESL to a gem (ruby      
>>>>>>>    package  manager).
>>>>>>>
>>>>>>> BR, Phil
>>>>>>>
>>>>>>> _________________________________________________________________________
>>>>>>> Professional FreeSWITCH Consulting Services:
>>>>>>> consulting at freeswitch.org
>>>>>>> http://www.freeswitchsolutions.com
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> Official FreeSWITCH Sites
>>>>>>> http://www.freeswitch.org
>>>>>>> http://wiki.freeswitch.org
>>>>>>> http://www.cluecon.com
>>>>>>>
>>>>>>> FreeSWITCH-dev mailing list
>>>>>>> FreeSWITCH-dev at lists.freeswitch.org
>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>>>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>>>>>> http://www.freeswitch.org
>>>>>>>





Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list