Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-07-2015, 02:01 AM   #1
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/": 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:


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 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, 02:50 AM   #2
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369

First of all, you cannot use whitespace when assigning variables in Bash.
FOO=BAR # This works
echo $FOO

BAR = FOO # This does not work
-bash: BAR: command not found
And here is a good tutorial on how to modify your $PATH:

Best regards,
Old 10-07-2015, 11:26 PM   #3
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,507

Rep: Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618Reputation: 2618
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 "

explicatly call it in your build line or or manually
export LD_LIBRARY_PATH=/opt/trs/lib64:$LD_LIBRARY_PATH
./configure -- prefix=/usr 
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
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 

place the 64 bit lib folders before the 32 bit ones

then reboot and CHECK IT!!!

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


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 05:03 PM
LD_LIBRARY_PATH or PATH for finding files jyunker Linux - Newbie 4 12-06-2013 09: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 10:27 AM
Setting the LD_LIBRARY_PATH Mark_667 Linux - Newbie 4 12-17-2008 12:26 PM
Editing Path and LD_LIBRARY_PATH Nappa Slackware 5 11-24-2003 12:14 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:04 PM.

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