problem with ruby1.8 and OpenMP in Ruby extension: shared object cannot be dlopen()'ed

R

Rudi Cilibrasi

Hi everybody,

I am the main developer of CompLearn, an open-source machine learning
library
for scientific researchers. I have written a Ruby binding for
CompLearn
called complearn-ruby. It has worked fine in the past. But it has a
problem
ever since I converted the base library (libcomplearn) to use OpenMP
for
multicore processor support. If I just try to use the simplest
approach that
has worked in the past in my extconf.rb, I get the following problem
when I
try to require the C-extension Ruby binding complearn4r.so and use the
multicore part of the system:

ruby: symbol lookup error: /usr/lib/libcomplearn.so.1: undefined
symbol: GOMP_parallel_start

To try to fix this error,

I adjusted the extconf.rb to include this line:

have_library('gomp', 'main')

And rebuilding works but running a simple test program (just trying to
require
complearn) fails in a different way than before:

/home/cilibrar/rlc/projects/complearn/complearn-ruby/ext/complearn/
complearn4r.so: libgomp.so.1: shared object cannot be dlopen()ed - /
home/cilibrar/rlc/projects/complearn/complearn-ruby/ext/complearn/
complearn4r.so (LoadError)
from /home/cilibrar/rlc/projects/complearn/complearn-ruby/lib/
complearn.rb:2
from tests/t2.rb:1:in `require'
from tests/t2.rb:1

I don't know what else to try and wonder if anybody else can offer a
clue?

I have tried for a long time experimenting with CFLAGS, CPPFLAGS,
LDFLAGS,
and -fopenmp among other settings but I still cannot seem to figure
out
a solution. I have put the source code for this problem up at

http://cilibrar.com/~cilibrar/projsup/rubbug/libcomplearn-1.0.4.tar.gz
and
http://cilibrar.com/~cilibrar/projsup/rubbug/libcomplearn-ruby-1.0.4.tar.gz

I would appreciate greatly any help anybody can offer in this
problem. Thank
you for your attention,

Rudi
 
G

gga

/home/cilibrar/rlc/projects/complearn/complearn-ruby/ext/complearn/
complearn4r.so: libgomp.so.1: shared object cannot be dlopen()ed - /

That probably means you have some undefined symbol most likely due to
a missing library during link time.

That being said, even if you manage to load and compile the stuff,
wrapping an OpenMP library is *probably* asking for trouble as ruby is
a single threaded application that relies on knowing how and where the
stack is. OpenMP will generate new threads behind your back, each one
with its own stack. Any call from those threads back to ruby will
probably lead to random crashes or memory issues.
 

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,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top