Skip to content

Instantly share code, notes, and snippets.

@hakonhagland
Last active October 10, 2018 19:12
Show Gist options
  • Save hakonhagland/624043aa57bee290a36b415055f5649b to your computer and use it in GitHub Desktop.
Save hakonhagland/624043aa57bee290a36b415055f5649b to your computer and use it in GitHub Desktop.
Install Gnu GSL library on Ubuntu

Download the tar file:

sudo apt-get install make
cd $HOME
mkdir -p gsl
cd gsl
wget http://gnuftp.uib.no/gsl/gsl-latest.tar.gz
tar zxvf gsl-latest.tar.gz
rm gsl-latest.tar.gz
cd gsl-2.5  # <-- change 2.5 to the directory name you got after extracting
./configure
make
sudo make install
make clean

Now libgsl has been 'installed' in /usr/local/lib, and you can compile a test program test.c using:

gcc -Wall -I/usr/local/include -c test.c
gcc -L/usr/local/lib test.o -lgsl -lgslcblas -lm

To run the executable a.out, remember to set the LD_LIBRARY_PATH environment variable in your shell startup files, or specify it on the command line:

$ LD_LIBRARY_PATH=/usr/local/lib a.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment