I am building a third party program which is using libraries from a directory which is not set in /etc/ld.so.conf
- therefore I link the program with the -rpath
option.
Running objdump -x bin/GetHistPrices | grep -i path
to check if -rpath
is set correctly I get the confirmation it is OK:
RUNPATH
/application/FXCM-API/GetHistPrices/bin:
/application/FXCM-API/lib:
/application/FXCM-API/sample_tools/lib
cmake
copies all libraries into the same directory where the executable is generated [e.q. ../GetHistPrices/bin
]; therefore the 1st path is OK.
Even more, the last 2 paths point also to directories where the shared libraries are located - these -rpath
options are added automatically by the cmake
script.
When I try to run the program NOT inside the ../GetHistPrices/bin/
directory [where it is located] - e.q. I don't execute it with ./GetHistPrices
- so I get this error message:
bin/GetHistPrices: error while loading shared libraries:
libgsexpat.so: cannot open shared object file: No such file or directory
The program only gets started when I either run it from the bin/
or /application/FXCM-API/lib
directory because the needed library is located there.
1)
When I run the program withLD_LIBRARY_PATH="/application/FXCM-API/GetHistPrices/bin" bin/GetHistPrices
then it starts. But this is what I see as well in the executable. Strange!
2)
Adding /application/FXCM-API/GetHistPrices/bin
to /etc/ld.so.conf
let start the program as well successfully.
OS is SLES 12.3 - honestly, somehow it looks to me like a bug in the system.
My question:
What am I doing wrong that it doesn't work even RUNPATH
is correctly set in the executable.
May be late to answer but may be useful for others. Some notes:
-Wl,--disable-new-dtags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With