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?