Sometimes in Linux when you install a new software package the instructions tell you to add a directory of shared libraries to your $LD_LIBRARY_PATH environment variable in your .bashrc.
You may have noticed that if you then create a shortcut icon on your desktop to this application it won't start because it can't find the libraries.
A typical solution is to write a wrapper shell script to set the LD_LIBRARY_PATH and then call that application.
Well, I've discovered how to add them to your system's library path allowing all environments to access them. Note: There are differences between Debian and Ubuntu (the two flavours of Linux that I'm familiar with).
Ubuntu
Create a new file in
Edit the file and add a line per directory of shared libraries (*.so files), it will look something like:
Edit
Add a line per directory of shared libraries (*.so files) to the bottom of the file, it will look something like:
If you still have problems you can obtain a list of the libraries that are on the system path by re-running the
Technorati Tags: LD_LIBRARY_PATH, Ubuntu, Debian, Linux, Andrew Beacock
You may have noticed that if you then create a shortcut icon on your desktop to this application it won't start because it can't find the libraries.
A typical solution is to write a wrapper shell script to set the LD_LIBRARY_PATH and then call that application.
Well, I've discovered how to add them to your system's library path allowing all environments to access them. Note: There are differences between Debian and Ubuntu (the two flavours of Linux that I'm familiar with).
Ubuntu
Create a new file in
/etc/ld.so.conf.d/
called .conf
Edit the file and add a line per directory of shared libraries (*.so files), it will look something like:
/usr/lib/APPLICATION/libReload the list of system-wide library paths:
sudo ldconfigDebian
Edit
/etc/ld.so.conf
Add a line per directory of shared libraries (*.so files) to the bottom of the file, it will look something like:
/usr/X11R6/libReload the list of system-wide library paths:
/usr/lib/APPLICATION/lib
ldconfigIf you run your new application it should now work fine without you having to set any LD_LIBRARY_PATH environment variables.
If you still have problems you can obtain a list of the libraries that are on the system path by re-running the
ldconfig
command in verbose mode:ldconfig -v
Technorati Tags: LD_LIBRARY_PATH, Ubuntu, Debian, Linux, Andrew Beacock
Comments
Joe joestain13@yahoo.com
And now the other way around:
I want to run an application but without a specif library. The application runs fine when I rename/remove the library. But removing the library completely is to drastic for me.
Can I use ldconfig, ld.conf, etc. to do this?
If so, how?
Cheers,
Kasper
I'm sorry to say that I'm not sure how to solve your issue! You can exclude whole directories from the LD_LIBRARY_PATH but no don't know of a way to exclude a particular one.
I think the rename option is probably the best so that you could always resurrect it if another application required it.
If you find a good solution please let me know!
I was having problems using a 3rd party shared library and adding the .conf file with the correct directory worked!
(Using Ubuntu)
My god I've been digging around for hours to run this application, I followed all the procedures above, but I don't understand where to make these changes as suggested in http://www.bcsoftnet.com/doc.htm
----
The Environmnet variable LD_LIBRARY_PATH must setup to the Oracle Library.
TNS_ADMIN and ORACLE_HOME variable also need to setup either one or both.
example for bash shell:
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
----
Is it working for anyone, please guide me.
thanks,
You see the lines starting "export ..." - they need to be added to the .bashrc or .profile file of the user that is trying to run them. If you are trying to run it from a graphical desktop such as Gnome or KDE then you either need to follow my ideas above or write a little shell script to add the variables in first.
Good luck!
This is really nice post.
I have created one shared library which is plugin for pidgin and it depends on libjava.so, libjvm.so
So I have created .conf file under /etc/ld.so.conf.d/ containing
/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386
/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/server
I did sudo ldconfig but still it is not able to locate the libjava.so when i start the pidgin application from
desktop shortcut.
It works fine when i put this in LD_LIBRARY_PATH and start pidgin from terminal.
Any idea what is wrong with my configuration?
I am using Ubuntu 10.10