Alex F
Alex F

Reputation: 43311

Persistent library search path in Linux

I want to change LD_LIBRARY_PATH variable globally, to use some strange third-party SDK, which places its shared libraries to custom directories. So, I added such script to /etc/profile.d:

LD_LIBRARY_PATH=/usr/local/ebus_sdk/lib/genicam/bin/Linux64_x64:/usr/local/ebus_sdk/lib/qt/lib:/usr/local/ebus_sdk/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

After reboot, I type this in the command line:

alex@alex-64:~$ echo $LD_LIBRARY_PATH
.

So, this way doesn't work. Is there any other way to add these directories to the library search path?

Upvotes: 4

Views: 7196

Answers (2)

Brian Cain
Brian Cain

Reputation: 14619

Most linux distros would have you add a file to the /etc/ld.so.conf.d directory which contains the path to search for the libraries. This is a convenient way for installers like rpm and dpkg to install and uninstall a package's system changes.

Upvotes: 4

Torbjörn
Torbjörn

Reputation: 5800

Try putting the two lines on one:

export LD_LIBRARY_PATH=/usr/local/ebus_sdk/lib/genicam/bin/Linux64_x64:/usr/local/ebus_sdk/lib/qt/lib:/usr/local/ebus_sdk/lib:$LD_LIBRARY_PATH

Edit:
Check whether some of the profile files do not overwrite LD_LIBRARY_PATH. Typical candidates are ~/.profile or ~/.bashrc (or appropriate for your kind of shell).

Upvotes: 3

Related Questions