0

I've edited my /etc/bashrc to set LD_LIBRARY_PATH like in my previous question that I asked. However it does not seem to be taking effect. Even though echo $LD_LIBRARY_PATH does show my modifications. And running my program: LD_LIBRARY_PATH="/usr/local/lib" ./test.cgi explicity does work. Do I need to reboot the system? What's going on?

unixman83
  • 1,972

2 Answers2

5

You need to export the variable.

export LD_LIBRARY_PATH="/usr/local/lib"
./test.cgi

Your formulation LD_LIBRARY_PATH="/usr/local/lib" ./test.cgi sets the variable in the current shell. If you're just running LD_LIBRARY_PATH=/usr/local/lib ; ./test.cgi you will set it in the current shell, but not in the child process ./test.cgi.

From the bash man page:

export:
        The supplied names are marked for automatic export to the environment of subsequently executed commands. 
cjc
  • 25,492
3

Try to run ldconfig -v to rebuild the library cache.

Sven
  • 100,763