I use gsl. After I compiled my .cpp file and run it, I faced with below error:
error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory
I found same as this problem in: https://groups.google.com/forum/#!topic/cortex_var/6vluX7pP0Sk & Linux error while loading shared libraries: cannot open shared object file: No such file or directory & http://www.gnu.org/software/gsl/manual/html_node/Shared-Libraries.html
And I have done as in the above links wrote but the error is still remained. Can anyone help me?
I got the same error with Krita on Arch Linux. I made a symlink with
and that fixed it.
You can use
gsl-config --libs
in you makefile or in the command line when you link the gsl library. Just typegsl-config
you can find the options it offers to you. Choose the options you need, you will find compile and link process much easier than before. As a result, when I typegsl-config --libs
in my terminal, I get-L/usr/local/lib -lgsl -lgslcblas -lm
. Although it is very simple, first you should know where you gsl is installed. You can add the directory to thePATH
environment variable or use the absolute path to executegsl-config
.Have you tried updating your library? The program I was trying to run simply needed a newer version of gsl (I had 1.9.5 while it needed 2.0.0 or newer).
If you are on arch you can run:
and select the appropriate one.
I needed
libgsl.so.19
:/snap/inkscape/current/bin/inkscape: error while loading shared libraries: libgsl.so.19: cannot open shared object file: No such file or directory
I solved it with:
libgsl.so.19
and found it in ~/anaconda3/libLD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/anaconda3/lib
(best add it to ~/.basrc)To make it work do the following steps
Start Borne Shell
now run your executable
It should work fine.
First, you need to locate the file (libgsl.so.0). You can do this, for example, by using the
find
command:Let us assume, the file is located in
/usr/local/lib
. (If the file has not been found, install the corresponding package or download the source, build it and install it.) Now, you have two options:(1) Quick & Dirty:
This adds the path of the library to an environment variable. The disadvantage of this option is, that it is only valid for the current session. It will not work for other users. It will not work once you log off and on again.
(2) Permanent:
Review your
/etc/ld.so.conf
. If/usr/local/lib
is not listed there, add it. Now, runldconfig
to detect the shared object file and add it to some system-wide index.