I'm having two problems related to the same issue:
I have a shared object saved in `pwd`/lib and while the executable that uses it compiles successfully (by using -l and -L switches), at runtime, it's giving me grief. If I try to run
LD_LIBRARY_PATH=/my/absolute/path/to/library/directory ./test
it works fine. But if I export LD_LIBRARY_PATH=/my/absolute/path/to/library/directory and do./test
it says that it can't find the shared library. However, if I doLD_LIBRARY_PATH=$LD_LIBRARY_PATH ./test
again it works fine!! Any ideas on what I'm doing wrong?Second issue is related to the exporting of the LD_LIBRARY_PATH env variable. If I open a terminal and type
export LD_LIBRARY_PATH=/path/to/stuff
and then typeecho $LD_LIBRARY_PATH
, the variable is correct. However if I write a script containing the export command, simply running it doesn't update the variable, instead I need to runsource install.sh
in order to actually persist the variable. What's the best solution for this?
Thank you for your time!