[Freeswitch-users] how to enable ESL for ruby?

dujinfang dujinfang at gmail.com
Tue May 26 09:20:09 PDT 2009


Thanks Brain. Got ESL.so, however on my Mac it is #include <ruby.h>  
instead of <ruby/ruby.h>.

But it can't find the ESL when I require 'ESL' in ruby. Even I put  
ESL.so in one of the dir of $:

Any clue for me?

seven at du-sevens-mac-pro:~/workspace/test/freeswitch/oldtrunk/libs/esl$  
make rubymod
cc  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 - 
ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict- 
prototypes -Wmissing-prototypes -c src/esl.c -o src/esl.o
cc  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 - 
ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict- 
prototypes -Wmissing-prototypes -c src/esl_event.c -o src/esl_event.o
cc  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 - 
ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict- 
prototypes -Wmissing-prototypes -c src/esl_threadmutex.c -o src/ 
esl_threadmutex.o
cc  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 - 
ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict- 
prototypes -Wmissing-prototypes -c src/esl_config.c -o src/esl_config.o
g++  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -Wall  
-Werror -Wno-unused-variable -c src/esl_oop.cpp -o src/esl_oop.o
ar rcs libesl.a src/esl.o src/esl_event.o src/esl_threadmutex.o src/ 
esl_config.o src/esl_oop.o
ranlib libesl.a
make MYLIB="../libesl.a" SOLINK="-dynamiclib -Xlinker -x" CFLAGS="-I/ 
Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/include - 
DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 -ffast- 
math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict- 
prototypes -Wmissing-prototypes" CXXFLAGS="-I/Users/seven/workspace/ 
test/freeswitch/oldtrunk/libs/esl/src/include -DHAVE_EDITLINE -g -ggdb  
-I../../libs/libedit/src/ -fPIC -Wall -Werror -Wno-unused-variable"  
CXX_CFLAGS="" -C ruby
g++  -I/Users/seven/workspace/test/freeswitch/oldtrunk/libs/esl/src/ 
include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -Wall  
-Werror -Wno-unused-variable -I/opt/local/lib/ruby/1.8/i686-darwin9 -c  
esl_wrap.cpp -o esl_wrap.o
g++ -dynamiclib -Xlinker -x esl_wrap.o ../libesl.a -lruby -framework  
Ruby -o ESL.so -L.
seven at du-sevens-mac-pro:~/workspace/test/freeswitch/oldtrunk/libs/esl$  
cd ruby/
seven at du-sevens-mac-pro:~/workspace/test/freeswitch/oldtrunk/libs/esl/ 
ruby$ ruby single_command.rb
single_command.rb:3:in `require': no such file to load -- ESL  
(LoadError)
         from single_command.rb:3
seven at du-sevens-mac-pro:~/workspace/test/freeswitch/oldtrunk/libs/esl/ 
ruby$ irb
irb(main):001:0> $:
=> ["/opt/local/lib/ruby/site_ruby/1.8", "/opt/local/lib/ruby/ 
site_ruby/1.8/i686-darwin9", "/opt/local/lib/ruby/site_ruby", "/opt/ 
local/lib/ruby/vendor_ruby/1.8", "/opt/local/lib/ruby/vendor_ruby/1.8/ 
i686-darwin9", "/opt/local/lib/ruby/vendor_ruby", "/opt/local/lib/ruby/ 
1.8", "/opt/local/lib/ruby/1.8/i686-darwin9", "."]
irb(main):002:0>
On May 26, 2009, at 11:27 PM, Brian West wrote:

> The makefile will have to be changed to work with OS X since the  
> linking is done differently.
>
> It would be very similar to this one http://www.bkw.org/esl.imac.diff
>
> Below will get it to compile:
>
> imac:esl brian$ svn diff
> Index: ruby/Makefile
> ===================================================================
> --- ruby/Makefile	(revision 13432)
> +++ ruby/Makefile	(working copy)
> @@ -1,6 +1,7 @@
>  ## no idea how to simply ask ruby which one to use
>  LOCAL_CFLAGS=-I$(shell ruby -e 'require "rbconfig"; puts  
> RbConfig::CONFIG["topdir"]')
>  LOCAL_LDFLAGS=$(shell ruby -e 'require "rbconfig"; puts  
> RbConfig::CONFIG["LIBRUBYARG"]')
> +LOCAL_LDFLAGS += -framework Ruby
>
>  all: ESL.so
>
> Index: ruby/esl_wrap.cpp
> ===================================================================
> --- ruby/esl_wrap.cpp	(revision 13432)
> +++ ruby/esl_wrap.cpp	(working copy)
> @@ -823,7 +823,7 @@
>
>
>
> -#include <ruby.h>
> +#include <ruby/ruby.h>
>
>  /* Remove global macros defined in Ruby's win32.h */
>  #ifdef write
> Index: Makefile
> ===================================================================
> --- Makefile	(revision 13432)
> +++ Makefile	(working copy)
> @@ -12,7 +12,7 @@
>  OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o
>  SRC=src/esl.c src/esl_event.c src/esl_threadmutex.c src/ 
> esl_config.c src/esl_oop.cpp
>  HEADERS=src/include/esl_config.h src/include/esl_event.h src/ 
> include/esl.h src/include/esl_threadmutex.h src/include/esl_oop.h
> -SOLINK=-shared -Xlinker -x
> +SOLINK=-dynamiclib -Xlinker -x
>  # comment the next line to disable c++ (no swig mods for you then)
>  OBJS += src/esl_oop.o
>
>
>
> /b
>
>
>
> On May 26, 2009, at 10:22 AM, dujinfang wrote:
>
>> Hi,
>>
>> Following the wiki: http://wiki.freeswitch.org/wiki/Event_Socket_Library
>> On MacOSX 10.5, I can't get ESL for ruby work. make throws error:
>>
>> sevens-mac-pro:~/workspace/test/freeswitch/trunk/libs/esl$ make  
>> rubymod
>> make MYLIB="../libesl.a" SOLINK="-shared -Xlinker -x" CFLAGS="-I/ 
>> Users/
>> seven/workspace/test/freeswitch/trunk/libs/esl/src/include -
>> DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC -O2 -ffast-
>> math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-
>> prototypes -Wmissing-prototypes" CXXFLAGS="-I/Users/seven/workspace/
>> test/freeswitch/trunk/libs/esl/src/include -DHAVE_EDITLINE -g -ggdb -
>> I../../libs/libedit/src/ -fPIC -Wall -Werror -Wno-unused-variable"
>> CXX_CFLAGS="" -C ruby
>> g++  -I/Users/seven/workspace/test/freeswitch/trunk/libs/esl/src/
>> include -DHAVE_EDITLINE -g -ggdb -I../../libs/libedit/src/ -fPIC - 
>> Wall
>> -Werror -Wno-unused-variable -I/opt/local/lib/ruby/1.8/i686-darwin9  
>> -c
>> esl_wrap.cpp -o esl_wrap.o
>> g++ -shared -Xlinker -x esl_wrap.o ../libesl.a -lruby -o ESL.so -L.
>> Undefined symbols:
>>   "_main", referenced from:
>>       start in crt1.10.5.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>> make[1]: *** [ESL.so] Error 1
>>
>> Thanks for any help.
>
> Brian West
> brian at freeswitch.org
>
> -- Meet us at ClueCon!  http://www.cluecon.com
>
>
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090527/2e7d50a9/attachment-0002.html 


More information about the FreeSWITCH-users mailing list