Forum: Ruby Loading an extension on statically linked ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Edgardo H. (Guest)
on 2009-01-05 21:45
(Received via mailing list)
Hi guys,

I've configured and built the Ruby interpreter with the following
options:

CFLAGS=-static ./configure --with-static-linked-ext --disable-shared --
without-openssl  --without-tk  --prefix=/opt/ruby

I also have an extension which was built with the following commands

# ruby extconf.rb
# make
gcc -I. -I/opt/ruby/lib/ruby/1.8/i686-linux -I/opt/ruby/lib/ruby/1.8/
i686-linux -I. -D_FILE_OFFSET_BITS=64  -fPIC -static   -c clicmd.c
gcc -shared -o clicmd.so clicmd.o -L. -L/opt/ruby/lib -Wl,-R/opt/ruby/
lib -L.  -rdynamic -Wl,-export-dynamic    -ldl -lcrypt -lm   -lc

When I run the script that requires this library I get an undefined
symbol error:

# ruby hpm.rb
./clicmd.so: ./clicmd.so: undefined symbol: rb_cObject - ./clicmd.so
(LoadError)

Any hints on how to solve this issue? Can I use dynamic extensions if
I have built ruby with statically linked extensions? Do I need to
statically link my extension to ruby?

Thanks in advance,
Edgardo
This topic is locked and can not be replied to.