Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
You don't need to reboot. The updated /etc/bashrc will be read when the user logs in again. Can you show the LD_LIBRARY_PATH and how you are running your executable? –  cjc Mar 24 '12 at 13:43
    
@cjc updated. Running with LD_LIBRARY_PATH="/usr/local/lib" ./test.cgi works ./test.cgi does not. –  unixman83 Mar 24 '12 at 13:44

2 Answers 2

up vote 4 down vote accepted

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. 
share|improve this answer
    
Your answer to my other question was incorrect because this works! :/ –  unixman83 Mar 24 '12 at 13:51
    
Yeah, sorry, I forgot to specify the export in bashrc. –  cjc Mar 24 '12 at 13:52

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

share|improve this answer
    
This was not the problem, but then again I just rebooted so it was probably already done. –  unixman83 Mar 24 '12 at 13:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.