cperlunixlinkerinline-c

How can I force Inline::C to link to an older library?


I'm dealing with a Perl Module that is only compatible with an older version of a shared system library. It just so happens that I have the older version of the library on my system, but I can't figure out how to force Perl's Inline::C to link up with that older library without removing the current, up to date library.

I'm trying to use Device::USB, which is compatible with the system library libusb 0.1, but is incompatible with libusb 1.0. My system does have libusb 1.0 and libusb 0.1 installed, but make test consistently fails while attempting to install the Device::USB module. This failure seems to be caused by Perl linking to the libusb 1.0 libraries instead of the libusb 0.1 libraries.

In /usr/lib I can see that the specific version of libusb that I want to use (libusb-0.1.so.4) is in there. What do I need to do to link specifically to this library instead of the generic libusb.a? Edit Makefile.PL? Edit the .pm files? Pass additional switches to make?

I've been reading up on the linker, but this additional layer of Inline::C really obfuscates when/where the traditional tricks of export LD_LIBRARY_PATH=/usr/local/my_lib:$LD_LIBRARY_PATH, -rpath, etc. can be applied.


Solution

  • Have you tried to use the Inline::C configuration option LIBS? According to the documentation you should be able to specify your lib with complete path then.