If you ever find yourself needing to figure out a dynamic library loading problem on Linux,
LD_DEBUGcan be a massive help.
This is an environment variable you can set to make the dynamic linker print out a ton of useful diagnostic info. There are a number of different values which control the amount and type of diagnostics printed. One of the values is help; if you set
LD_DEBUGto this and run executable it will print out a list of all the available options along with brief descriptions. For example, on my Linux workstation at the office:
> LD_DEBUG=help cat Valid options for the LD_DEBUG environment variable are: libs display library search paths reloc display relocation processing files display progress for input file symbols display symbol table processing bindings display information about symbol binding versions display version dependencies all all previous options combined statistics display relocation statistics unused determined unused DSOs help display this help message and exit To direct the debugging output into a file instead of standard output a filename can be specified using the LD_DEBUG_OUTPUT environment variable.
Be warned: using
LD_DEBUG=allwill generate a lot of output!
This is documented on the man page for ld.so. There are a lot of other environment variables that can control the behaviour of the dynamic linker too, so it's worth a read.