Skip to content

GNU Scientific Library

Install

  1. Get the download URL for the file gsl-latest.tar.gz by visiting the website: https://www.gnu.org/software/gsl/

    Use that download URL via the terminal (e.g., using one possible URL):

    wget https://mirrors.ibiblio.org/gnu/gsl/gsl-latest.tar.gz -O gsl-latest.tar.gz
    
    This will dowload the file gsl-latest.tar.gz.

  2. Extract the contents, in the terminal run:

    tar -xzf gsl-latest.tar.gz
    
    This will extract into a new folder, for instance it is gsl-2.8, which contains the version number you've dowloaded.

    Change the directory in your terminal: cd gsl-2.8 (possibly adjust the version number).

  3. How to compile and install GSL, is written in the text file INSTALL. It needs three steps that are very common: "configure" → "make" → "make install".

    We will modify one thing because we cannot write files in directories that require root access. So, we want to specify another directory for GSL to be installed. The INSTALL document tells us how:

    You can specify an installation prefix other than /usr/local by giving configure the option --prefix=PREFIX, where PREFIX must be an absolute file name.

    That's why we run in the terminal:

    ./configure --prefix=$HOME/build/gsl-2.8
    
    This will eventually put the GSL files into your home directory ($HOME is a variable with your home directory) inside the folder build/gsl-2.8 (it's ok if you choose another directory, too).

    After configure finished running, we compile (it takes a few minutes):

    make
    
    (make will end with: make[1]: Leaving directory '/home/jrudi/code/gsl-2.8')

    After compiling with make is finished, we install:

    make install
    
    This last step will simply copy all the files that GSL needs into the directory that we told it to use, namely with --prefix=...