robhoelz has asked for the wisdom of the Perl Monks concerning the following question:
Hey monks, I'm working on a Lua-Perl bridge, and I've hit a snag on the way. Basically, I'm writing a dynamically-loadable module for Lua that allows Lua to evaluate Perl expressions (later on, I hope for it to be able to exchange data between the two environments seamlessly). Things work fine until I evaluate something like use Scalar::Util, which results in the following error (I'm on Fedora 12, 64-bit):
Can't load '/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/auto/B/B +.so' for module B: /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/auto/B/B.so: undefin +ed symbol: PL_opargs at /usr/lib64/perl5/5.10.0/x86_64-linux-thread-m +ulti/XSLoader.pm line 64. at /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/B.pm line 316
I checked out the "Using Perl modules, which themselves use C libraries, from your C program" section of perlembed, but it didn't have much to say on this kind of error. However, if I build a custom Lua interpreter with my module statically linked into it, use Scalar::Util works without a problem. I understand the basics of linking, but when a dlopen'd module is linked to a shared object that dlopens other modules...that's when I get confused.
In the interest of getting a good response, I've created a sample program that replicates this error, sans Lua. The source is available here:
http://hoelzro.net/public/perl-test.tar.gzIf you extract the archive and run make, it'll create two executables: test-static and test-dynamic. Running test-static should just print Scalar::Util's version. Running test-dynamic will print an error message similar to the one above, along with Scalar::Util's version.
I would appreciate any and all help you would be able to give me!
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl embedding woes: undefined symbols
by ikegami (Patriarch) on Apr 29, 2010 at 19:53 UTC | |
by robhoelz (Acolyte) on Apr 29, 2010 at 20:53 UTC | |
by ikegami (Patriarch) on Apr 29, 2010 at 21:44 UTC | |
by robhoelz (Acolyte) on Apr 29, 2010 at 22:57 UTC | |
by ikegami (Patriarch) on Apr 30, 2010 at 20:46 UTC | |
|
Re: Perl embedding woes: undefined symbols
by Fletch (Bishop) on Apr 29, 2010 at 19:25 UTC | |
by robhoelz (Acolyte) on Apr 29, 2010 at 19:57 UTC | |
|
Re: Perl embedding woes: undefined symbols
by robhoelz (Acolyte) on May 04, 2010 at 21:38 UTC | |
|
Re: Perl embedding woes: undefined symbols
by robhoelz (Acolyte) on May 04, 2010 at 14:32 UTC |