tags:

views:

17

answers:

1

I have a library built using libtool which is install into the package's library directory, /usr/local/lib/myprog/libmylib.so. I'm dynamically loading the library in my code with libltdl. When I try to load this library on one machine, it works just fine. On another, with the same build and the library installed on the same location, I get a "file not found" error.

If I call lt_dlforeachfile directly before lt_dlopenext (which I use to load the library), then I can see by printing out filenames that the library I need has been found in the search path. But then immediately after, loading it fails with a "file not found" error. Any suggestions?

UPDATE

I have tried switching to using dlopen and explicitly specifying the absolute path to the library. This still works on some systems and not on the other.

A: 

It turned out that libltdl was hiding the real error. the "file not found" was from another library that the library I was loading depended on. I discovered this when using dlerror() to print the error messages. After installing the missing library, all is well!

Michael Mior