I've got a very perplexing problem involving shared libraries.

I'm trying to build a Perl extension to the beepcore-c library (as described by Marshall Rose in his BEEP book for O'Reilly). As part of this API, the developer writes a number of "profiles" that are loaded dynamically as needed by the BEEP core (well, the wrapper, but let's not pick nits). I have been trying to develop a Perl API so that people could write profiles in Perl instead of C, thereby making the whole thing a lot more accessible.

In addition, I want to be able to write BEEP driver programs in Perl too. So I basically have two problems: What should be a straightforward Perl extension (to beepcore-c), and specification of Perl profiles.

beepcore-c comes with a fairly elaborate make system that uses libtool. It builds fairly smoothly. I decided to solve my second problem (drivers) first, so I put a large part of the top-level beepcore API into SWIG and use ExtUtils::MakeMaker for the makefiles. The profiles are still in C. Again, no problems, once I specified all the right libraries in Makefile.PL. But when I come to load profiles (which are shared object libraries) the Perl extension fails me -- the profile loader (written in C to use dlopen) can't find the object libraries and resolve the symbols correctly.

I tried to specify -Wl,--rpath -Wl,{LIBDIR} in the WriteMakefile LDDLFLAGS attribute and ran into what are apparently some gcc problems:

/usr/lib/crt1.o: In function '_start':
/usr/lib/crt1.o(.text+0x18): undefined referencet to 'main'
collect2: ld returned 1 exit status

This doesn't happen in the libtool version.

Not only that, but when I explicitly specify LD_LIBRARY_PATH before executing my perl program, it still can't find the libraries and resolve the symbols.

I can't help feeling that I'm close and missing something really obvious here. Should I be using libtool in my own make process? How do I do that? Or is there an easier way?

Incidentally, I'm using perl 5.6.2 and 5.8.3 (same results in both) and gcc 3.0.0 (same results in gcc 2.96) on Linux 2.4.25.

Thanks.

d

Reply via email to