LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   including usr/local/lib directory (https://www.linuxquestions.org/questions/linux-software-2/including-usr-local-lib-directory-272610/)

Quest101 01-01-2005 12:42 PM

including usr/local/lib directory
 
Hi i am new to linux and i am using Fedora core 2.

I am currently using an API called jrtplib. However when i install it , it install all the library files to a /usr/local/lib . Unfortunatley the the g++ compiler i am using ( not sure which version ) doesnt check that directory when searching for errors ,, so of course a whole lot of "undefined reference errors " arise at compile time .

What i want to know if what modification needs to be made to allow the compiler or whatever is responsible for the aspect , so as to force it too check the usr/local/lib directory rather than onlyt the usr/lib directory.

thanx in Advance, Quest

btmiller 01-01-2005 12:53 PM

Add /usr/local/lib to your LD_LIBRARY_PATH environment variable, i.e.

export LD_LIBRARY_PATH=/usr/local/lib

Edit /etc/ld.so.conf to make the change permanent and visible accross users.

Pedroski 01-01-2005 02:11 PM

That doesn't work. I did it. You will have to change your bash or other shell profile. Sorry btmiller, but I had the same advice, from you or someone and it didn't work. It won't stay exported

__J 01-01-2005 04:13 PM

To make LD_LIBRARY_PATH stay permanent, You have to add it to /etc/profile (system wide) or ~/.bashrc(for user only).
when you add an entry to /etc/ld.so.conf you *MUST* run /sbin/ldconfig (as root) for it to take permanent effect. ldconfig rebuilds the /etc/ld.so.cache file and the /usr/local/lib files will be searched for by the linker. Generally, LD_LIBRARY_PATH is not the best way to go as it is often misused.

When exporting environment variables, like LD_LIBRARY_PATH the following:

export LD_LIBRARY_PATH=/usr/local/lib

sets LD_LIBRARY_PATH only to usr/local/lib - so if the system had say /opt/whatever/lib in its LD_LIBRARY_PATH that would be gone after the above command.

Instead use LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - this sets /usr/local/lib as the first directory LD_LIBRARY_PATH searches and doesn't disturb anything that was previously in its path.

alternatively, export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib set /usr/local/lib as the last directory it searches without disturbing the rest of the path.

But, the right way to do it is add /usr/local/lib to /etc/ld.so.conf and run /sbin/ldconfig and that will correct
your problem.

By the way, if you want to see what ldconfig is finding, run (as root) 'ldconfig -v | more' and you can see exactly what libraries it is finding.


All times are GMT -5. The time now is 07:33 PM.