error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory

后端 未结 8 775
滥情空心
滥情空心 2021-02-05 07:06

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

相关标签:
8条回答
  • 2021-02-05 07:46

    In my experience, fastStructure depends on gsl 1.6 but not the latest version.

    wget http://gnu.mirror.vexxhost.com/gsl/gsl-1.6.tar.gz
    tar -zxvf gsl-1.6.tar.gz
    cd gsl-1.16
    ./configure
    make
    sudo make install
    

    Add these lines to your .bashrc file on your home directory.

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export CFLAGS="-I/usr/local/include"
    export LDFLAGS="-L/usr/local/lib"
    

    then, run source ~/.bashrc to set these environment variables.

    It works fine when I change the version from the latest to the 1.6.

    0 讨论(0)
  • 2021-02-05 07:48

    You can use gsl-config --libs in you makefile or in the command line when you link the gsl library. Just type gsl-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 type gsl-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 the PATH environment variable or use the absolute path to execute gsl-config .

    0 讨论(0)
  • 2021-02-05 07:50

    I got the same error with Krita on Arch Linux. I made a symlink with

    ln /usr/lib/libgsl.so /usr/lib/libgsl.so.0
    

    and that fixed it.

    0 讨论(0)
  • 2021-02-05 07:58

    First, you need to locate the file (libgsl.so.0). You can do this, for example, by using the find command:

    sudo find / -name "libgsl.so.0"
    

    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:

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

    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, run ldconfig to detect the shared object file and add it to some system-wide index.

    0 讨论(0)
  • 2021-02-05 07:59

    To make it work do the following steps

    Start Borne Shell

    $LD_LIBRARY_PATH= path to your gsl lib folder inside the gsl installation folder
    $export LD_LIBRARY_PATH
    

    now run your executable

    It should work fine.

    0 讨论(0)
  • 2021-02-05 08:00

    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:

    yaourt gsl
    

    and select the appropriate one.

    0 讨论(0)
提交回复
热议问题