Run ldd on the binary with the parameter
I know I ldd
can only accept binary as a parameter, and here I am asking how to run ldd
with binary mybin
, say mybin
with a binary parameter mybin
. Eg mybin --myparam./configfile.conf
.
The linker is different if I add a conf file for my binary because it loads some plugins at runtime with shared plugin object files plugin1.so
like that. I have a vague link issue, but I still don't know which file .so
I was missing.
If I run ldd./mybin
everything is linked and a simple binary is running. Once I add a conf file for my binary to allow it to load some common plugin libraries, then my binary will report errors while loading those libraries (coded exception, with some undefined reference
error messages).
So if there is a way to start ldd
with mybin --myparam./a.file
something like this will help a lot.
source to share
Use an environment variable LD_DEBUG
for this. To view the related options, run any command with LD_DEBUG=help
. For example, running LD_DEBUG=help ls
on my machine gives this output:
LD_DEBUG=help ls
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
scopes display scope information
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.
One way to debug your dlopen
s, or whatever late loading mechanism you use, is to run your executables with the appropriate arguments with LD_DEBUG=all
. This will give you long output detailing the character search and search path. This output will also tell you about permission failures.
source to share