18

I need to do this:

On linux, we have to find a few dynamic libraries which are not on a standard location. We have to set $LD_LIBRARY_PATH to /path/to/sdk/lib

How can I do that in Ubuntu 10.10?

Richard Knop
  • 1,149
  • 2
  • 20
  • 34

3 Answers3

42

To define this variable, simply use (on the shell prompt):

export LD_LIBRARY_PATH="/path/to/sdk/lib"

To make it permanent, you can edit the ldconfig files. First, create a new file such as:

sudo vi /etc/ld.so.conf.d/your_lib.conf

Second, add the path in the created file

/path/to/sdk/lib

Finally, run ldconfig to update the cache.

sudo ldconfig
Khaled
  • 36,533
  • 8
  • 72
  • 99
  • Are the quotes necessary for LD_LIBRARY_PATH? – SAFX Apr 02 '13 at 04:29
  • 1
    @SAFX yes, if the path has spaces or special characters and if they are not escaped. – VanagaS Jan 14 '17 at 06:28
  • This may not work for some versions of Ubuntu. See: [LD_LIBRARY_PATH not loading from .profile nor /etc/environment](https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728) – MikeTronix May 25 '18 at 15:14
6

In bash, assign it before the executable to be run.

LD_LIBRARY_PATH=/path/to/sdk/lib ./somedevtool
Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84
0

You have to run the

export LD_LIBRARY_PATH="/path/to/sdk/lib"

to export the path to the compilers.
Default path is in usr/bin
Copy and paste the path into the your_lib.conf file in the location /etc/ld.so.conf.d then save and exit.

sudo ldconfig

Run this to confirm the changes in the files which added the paths