LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-25-2004, 03:37 PM   #1
abatista
LQ Newbie
 
Registered: Apr 2004
Location: Miami, FL USA
Distribution: Fedora Core 1
Posts: 2

Rep: Reputation: 0
how do I add a path to the LD_LIBRARY_PATH


I know that I am new to linux so here is a stupid question.

I have to add a path to the LD_LIBRARY_PATH acording to an cvs that I need to install. What I have to actual add is the path /usr/local/lib.

Now I have done echo $LD_LIBRARY_PATH and got nothing.

So I guess that my next step is to do PATH=$PATH:/usr/local/lib; export PATH

But I want to make this stay. I have looked into the /etc/bashrc But it looks like a programming lines and can't seem to understand how to add it there. Also I have looked at ~/.bashrc with similar view.


Please someone help.
 
Old 10-25-2004, 03:43 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,568

Rep: Reputation: 164Reputation: 164
Add it to /etc/basrc, maybe in simplier form like
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
as the last line of the file (after all existing commands).
 
Old 10-25-2004, 03:48 PM   #3
abatista
LQ Newbie
 
Registered: Apr 2004
Location: Miami, FL USA
Distribution: Fedora Core 1
Posts: 2

Original Poster
Rep: Reputation: 0
Ok I have done that. Also I added it to /etc/ld.so.conf but the man says to then do idconfig which on my FC1 just gives me bash message as it's missing.

Let me test the above entry to see if this works. Again thanks.
 
Old 10-25-2004, 03:50 PM   #4
emathias
LQ Newbie
 
Registered: Oct 2004
Distribution: Gentoo
Posts: 24

Rep: Reputation: 15
Perhaps I do not understand what are you intending to do.
But I think that is somethink like this...

% export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Does it works ?
 
Old 10-25-2004, 04:18 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,568

Rep: Reputation: 164Reputation: 164
Quote:
Originally posted by abatista
Ok I have done that. Also I added it to /etc/ld.so.conf but the man says to then do idconfig which on my FC1 just gives me bash message as it's missing.
idconfig? ldconfig
Also it's in /sbin (/sbin/ldconfig), so your normal user may not have it in PATH. Run it as root and will work.
 
Old 10-25-2004, 04:27 PM   #6
vasudevadas
Member
 
Registered: Jul 2003
Location: Bedford, UK
Distribution: Slackware 11.0, LFS 6.1
Posts: 519

Rep: Reputation: 30
Quote:
Originally posted by abatista
Ok I have done that. Also I added it to /etc/ld.so.conf but the man says to then do idconfig which on my FC1 just gives me bash message as it's missing.
I'd stick it in your .bashrc file instead.

But one thing: do you need the library path for an application you installed from source?

If so, there is a much better way of specifying the library path: with a runpath.

To set a runpath, before you compile the application (indeed, before running the configure script if there is one) set the following variable:

export LDFLAGS="-rpath /path/to/library "$LDFLAGS

If the application you need the library path for was installed as binary, don't worry about this advice. Try to remember it though for the future, if you ever do install something from source. Runpaths are better than LD_LIBRARY_PATH.

Edit: don't take my word for it:
http://www.visi.com/~barr/ldpath.html

Last edited by vasudevadas; 10-25-2004 at 04:30 PM.
 
Old 10-27-2004, 03:20 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Quote:
Also I added it to /etc/ld.so.conf
If you did this, and then ran /sbin/ldconf as root, you don't need the LD_LIBRARY_PATH changes.

Sometime you will install a program that was ported from Delphi for instance that needs a special library file, which resides in a subdirectory of the program directory. In that case you can put a script by the name of the program in your ~/bin folder and have the first line be
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

The next line would call the program with a full path name. This could also be used to run a program which needs a library file of a certain version to run, but you can't install in /usr/lib for whatever reason.
 
Old 01-05-2014, 05:03 PM   #8
Santosa Sandy
LQ Newbie
 
Registered: Jan 2014
Posts: 1

Rep: Reputation: Disabled
Smile Just to avoid confusion for adding position

In order to avoid double colons code inside the LD_LIBRARY_PATH

Code:
::
We should choose between these two commands:

Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
or

Code:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Correct me if I am wrong, please. Thank you

Last edited by Santosa Sandy; 01-05-2014 at 05:06 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
Add path to @INC deus1 Linux - Software 0 07-27-2005 08:52 AM
How do I add library path? scc28y Linux - Newbie 5 03-18-2005 11:56 PM
add man path alaios Linux - General 2 03-14-2004 10:45 PM
How do I add something to my $PATH? iammeuno Linux - Software 1 12-18-2003 05:02 PM
Editing Path and LD_LIBRARY_PATH Nappa Slackware 5 11-24-2003 12:14 AM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration