skip to content

A numerical library for C and C++ programmers.

Instructions for users: 

On Ubuntu when you compile, link in the library with -lgsl -lgslcblas -lm eg

 $ gcc test.c -o test -lgsl -lgslcblas -lm 
Licence Details: 

There are manpages and info pages. There is also documentation on the homepage (above).

Admin notes: 


You only need to build it on SuSE. Ubuntu has it as part of the distro.

 ./configure --prefix=/usr/local/shared/gsl/1.11/32 make make check > log 2>&1 make install 

For reference, the 32-bit library was compiled on the Theory sector SuSE 10.2 image and the 64-bit one on the 10.3 image because that's what was available at the time.


I tested that the library was basically working with this snippet from the Info pages:

 #include <stdio.h> #include <gsl/gsl_sf_bessel.h>  int main (void) {   double x = 5.0;   double y = gsl_sf_bessel_J0 (x);   printf ("J0(%g) = %.18e\n", x, y);   return 0; }  

The output was

 J0(5) = -1.775967713143382642e-01 

It is OK if the last few digits do not match.

When making the module to load gsl I added the LD_RUN_PATH variable because this library is going to be used with gcc, which is the one local compiler that's not wrapped to add -rpath options automatically. This means that LD_RUN_PATH may actually be useful (the linker ignores it if any -rpath options are present). I also set LD_LIBRARY_PATH in case people did decide to pass their own -rpath options and so clobbered the effect of LD_RUN_PATH.

There was a slight weirdism in that in the SuSE 10.3 image this all appeared to work nicely when linked with '-lgsl' rather than the full '-lgsl -lgslcblas -lm'. I think this is due to a difference in linking behaviour between 10.3 and 11.1- despite what the manpage says, ld's '--no-allow-shlib-undefined' option seems to be the default in 11.1. If you slap '-Wl,--allow-shlib-undefined' on the end of the compilation then all is well with the simple test case above. Or alternatively '-Wl,--unresolved-symbols=ignore-in-shared-libs'. Not that this is a good idea.

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.