LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-07-2015, 01:01 AM   #1
om178890
LQ Newbie
 
Registered: Aug 2015
Posts: 19

Rep: Reputation: Disabled
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.
 
Old 10-07-2015, 01:50 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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
 
Old 10-07-2015, 10:26 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,622

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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

Last edited by John VV; 10-07-2015 at 10:38 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I add a path to the LD_LIBRARY_PATH abatista Linux - Newbie 7 01-05-2014 04:03 PM
LD_LIBRARY_PATH or PATH for finding files jyunker Linux - Newbie 4 12-06-2013 08:10 AM
LD_LIBRARY_PATH is mentioned with the library path: /usr/bin/ld: cannot find -ljson ven_visu Linux - Software 1 08-05-2011 09:27 AM
Setting the LD_LIBRARY_PATH Mark_667 Linux - Newbie 4 12-17-2008 11:26 AM
Editing Path and LD_LIBRARY_PATH Nappa Slackware 5 11-23-2003 11:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration