LD_LIBRARY_PATH not working while LD_PRELOAD works fine
c, c++, gcc, linux
Solution
You need to give paths in LD_LIBRARY_PATH variable:
LD_LIBRARY_PATH=$PWD ./program args
Problem
I am compiling a program on one machine and running it on another one which does not have compatible libstdc++ library. If I run it like this, that is using LD_PRELOAD, it runs fine. ``` LD_PRELOAD=./libstdc++.so.6 ./program args ``` However, If I try to use LD_LIBRARY_PATH, like shown below, it doesn't load the library and I get the error that I don't have the required libstdc++ version. ``` export LD_LIBRARY_PATH="./libstdc++.so.6" ./program args ``` How can I solve this problem?