Tuesday, December 23, 2014

Installing GSL on Linux

Setting up GSL
1. Downloading gsl library
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.7.tar.gz

2. Unpack file, this create a new directory called gsl-1.7 in your home directory
tar -zxvf gsl-1.7.tar.gz

3. Create a new directory
mkdir /home/justin/dev

4. Configure the installation and tell it to use your new directory
./configure --prefix=/home/justin/dev

5. Actual installation
make
make check
make install

Linking libraries
1) C
gcc -Wall -I/home/justin/dev/include -c example.c
gcc -L/home/justin/dev/lib example.o -lgsl -lgslcblas -lm

2) Similarly, C++
g++ -Wall -I/home/justin/dev/include -c example.cpp
g++ -L/home/justin/dev/lib example.o -lgsl -lgslcblas -lm

Then proceed to run program with
./a.out

No comments:

Post a Comment