Loading an extension on statically linked ruby

E

Edgardo Hames

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,063
Latest member
StormyShuf

Latest Threads

Top