Sometimes you may get an error like this when opening your application “Error while loading shared libraries:libgsl.so.25: 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 libgsl.so.xx?
-
Download gsl from using the command below wget http://gnu.mirror.vexxhost.com/gsl/gsl-2.5.tar.gz (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 (libgsl.so.xx where the xx corresponds to the version of gsl)
-
Then untar the file using the command tar -zxvf gsl-2.5.tar.gz
-
Then go to the directory cd gsl-2.5
-
Then run the command ./configure
-
Then run the command “make” (It will take nearly 5 minutes)
-
Then click on “sudo make install” (This will install GSL)
-
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 – https://www.gnu.org/software/gsl/ 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"
Example:

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