From: Sean Middleditch Date: 2002-04-03T13:27:19+09:00 Subject: Re: Request for Advice -- Undefined Symbol You need to make the executable export it symbols (-dynamic flag to gcc, I think). The extension is looking for the symbol in Ruby, which you said is loaded from the static archive libruby.a, and if your app doesn't export it symbols, the loaded library won't be able to find them, or Ruby's. On Tue, 2002-04-02 at 23:01, Dennis Newbold wrote: > Unless you've tried doing something like this, you may not be > able to help much, but I'm hoping that someone on the list has > encountered this problem or a similar one before. > > For reasons to lengthy to go into now, what I am attempting to > do is to write a C program which embeds a Ruby interpreter > which then runs a ruby script which then "requires" an extension > module which is written in C. Like I said, don't ask why unless > you want a 5 minute explanation. > > The problem is that one of the routine in the extension module > call rb_raise, passing rb_eTypeError as an argument. rb_eTypeError > is coming up as an undefined symbol, and the require statement is > failing. I've given: > > -Wl,-rpath,/usr/lib/ruby/1.6/i686-linux as an argument to gcc > > to tell ld-linux.so to include this directory in its search path, > and rb_eTypeError is defined in error.o which is found in libruby.a. > nm shows the type of rb_eTypeError to be 'C', which means a common > symbol, although I'm not sure that makes a difference. Anyway, > so far, I can't figure out why the dynamic loader (dlopen call in > dln.c) can't seem to find the definition of rb_eTypeError. > > I tried writing a small example program, which "required" a small > exa.rb routine which defined a module with one method which > immediately called "raise TypeError, ...". Unfortunately, for > some unknown reason, the example worked, while my program > doesn't. > > If anyone has any suggestions, I'd appreciate it. In the meantime, > I'll try to come up with a simple example program which illustrates > the problem. Thanks. > > Dennis > > --------------------------------------------- > | | > | The way to be happy is to be good | > | | > --------------------------------------------- >