LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PATH and LD_LIBRARY_PATH setting error on Linux (https://www.linuxquestions.org/questions/linux-newbie-8/path-and-ld_library_path-setting-error-on-linux-4175555500/)

om178890 10-07-2015 01:01 AM

PATH and LD_LIBRARY_PATH setting error on Linux
 
Hi ,

I am getting some errors of "/usr/lib/libcap.so.2": Invalid operation when i set
LD_LIBRARY_PATH = LD_LIBRARY_PATH=/usr/lib:/lib64:/lib:/opt/trs/lib64:/usr/lib64:/lib64:/lib:/opt/trs/lib64:/opt/CCS:/opt/som/lib64:

and

PATH = export PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/trs/bin:/opt/trs/bin:/sbin:/usr/sbin:/usr/bin:/bin:/flash/bin:/opt/som/bin:

It is because libcap.so.2 library is present at both the path /opt/trs/lib64 and /usr/lib.

As per the requirement library should be picked from /opt/trs/lib64.

But if i set


export LD_LIBRARY_PATH=/opt/trs/lib64:/usr/lib64:/lib64:/lib:/opt/trs/lib64:/opt/CCS:/opt/som/lib64:/usr/lib:/lib64:/lib:

and PATH = PATH=/opt/trs/bin:/opt/som/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/trs/bin:/opt/trs/bin:/sbin:/usr/sbin:/usr/bin:/bin:/flash/bin:/opt/som/bin:

then i get segmenttation fault by executing the ls command on shell.

Can any one help me how to these path so that i can avoid these error.

HMW 10-07-2015 01:50 AM

Hi!

First of all, you cannot use whitespace when assigning variables in Bash.
Code:

FOO=BAR # This works
echo $FOO
BAR

BAR = FOO # This does not work
-bash: BAR: command not found

And here is a good tutorial on how to modify your $PATH:
http://www.troubleshooters.com/linux/prepostpath.htm

Best regards,
HMW

John VV 10-07-2015 10:26 PM

Quote:

As per the requirement library should be picked from /opt/trs/lib64.
if a file with the SAME NAME -- a very bad idea ! -- rename one of them !!!

is in /usr/lib AND in /opt/trs/lib64
the order of being used is FIRST COME FIRST SERVED

you have the needed and REQUIRED "/usr/lib ( a 32 bit folder!!!! ) coming before the 64 BIT /opt/trs/lib64

so you WILL have issues
the 32 bit one is being used

rename the one you placed in "/opt/trs/lib64 "
or

explicatly call it in your build line or configure.in or manually
Code:

export LD_LIBRARY_PATH=/opt/trs/lib64:$LD_LIBRARY_PATH
./configure -- prefix=/usr
make
su
make install



on 64 bit MULTI lib systems it is best to make 100 SURE that the 64 bit libs are seen FIRST by gcc
not everything dose a good job checking 32 VS 64 bit

in /etc/profile.d
write a script
or ( and this can be undone by updates )
edit /etc/profile
or if /etc/profile is set to look for a "/etc/profile.local" file make one ( this will not be undone by updates)
-- profile.local
Code:

PATH=$PATH:-- set them to YOUR system
C_INCLUDE_PATH= -- my CUDA install include folder
CPLUS_INCLUDE_PATH= -- my CUDA install include folder
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/lib:-- and so on
PKG_CONFIG_PATH=/???/??? -- if you have a few -- I DO

export PATH LD_LIBRARY_PATH PKG_CONFIG_PATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH

place the 64 bit lib folders before the 32 bit ones

then reboot and CHECK IT!!!
Code:

echo $LD_LIBRARY_PATH


All times are GMT -5. The time now is 05:06 AM.