Skip to content

Solved: cannot open shared object file: No such file or directory

Sometimes you may get an error like this when opening your application “Error while loading shared cannot open shared object file: No such file or directory”. The error mainly occurs to the system not being able to find the “libgsl” libraries.

How to resolve the error loading shared libraries

  1. Download gsl from using the command below wget (The versions can differ). I installed 2.7 version and was still getting the error and when I installed 2.5 version, the error went away ( where the xx corresponds to the version of gsl)

  2. Then untar the file using the command tar -zxvf gsl-2.5.tar.gz

  3. Then go to the directory cd gsl-2.5

  4. Then run the command ./configure

  5. Then run the command “make” (It will take nearly 5 minutes)

  6. Then click on “sudo make install” (This will install GSL)

  7. After installing the GSL add the below commands to .bashrc profile at the fag end (It would be generally located at under /home/username/.bashrch

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

This error occurs due to following reasons

  • GSL library is not installed or corrupted
  • GSL library is installed but not added to the library path

Installing GSL Library:
This can be downloaded from here – and installed

Adding library path:
If you have installed GSL and then need to add the library path, do it like as shown below (Refer to the actual path below)

 export LD_LIBRARY_PATH="/home/location/gsl/lib"


In case if you get any specific error related to gsl then you need to install a specific version like 2.5 (or) later and follow the below steps

cd gsl-1.16