Building GSL on Windows

3.22.2014

A few pointers for compiling Windows binaries of the GNU Scientific Library (GSL).

Description

The GNU Scientific Library (GSL) is a fantastic library for scientific computing. Within the C/C++ world I don't think there's anything comparable. My only gripe is the C-style interface, I would prefer C++. Anyways, I tend to use it quite a bit. Personally I use a combination of OS X and Linux, both of which are easy platforms for GSL - the latter moreso, but on OS X you can get it easily through the package managers (I currently use brew).

Windows

Unfortunately many other people in this world still use Windows for scientific computing, so I have to be cross-platform. I've starting using the Visual Studio toolchain, in particular Visual Studio 2013. I can get it for free as a student (through Dreamspark) and it plays nicely with Python.

After some internet sleuthing I found that someone has already made a Visual Studio project for compiling GSL, which can be found here. Thanks Brian! He only advertises it as working with Visual Studio 2012. However with a few tweaks I managed to get it to work on 2013. There were a few header files the project looked for in the wrong place. Also it is finicky about order. I found out that you have to build the statically-linked libraries first, and then the dynamically-linked libraries. For the latter I had to copy the *.lib files into wherever it wanted them. Fortunately the error messages encountered tend to be helpful.

As a simplicity for anyone who wants them, I built binaries (lib and dll) using GSL v1.16 and VS2013 for both 32-bit and 64-bit architecture, and they are available here (zip, 12MB). Have fun!