GSL for windows.
Actually, we can compile lib and include for x64. Msys and mingw are two essential compenents. But this time I installed msys and mingw respectively, while I have installed the complex suite, which just for i386.
- Download MSYS-20111123.zip and unzip.
- Visit the website of mingw_w64, and click Mingw-builds, you would download the mingw-w64-install.exe from sourceforge. Then you just run this file and install.
- Note that we just install two seperate program, so we need to "connect" them. Open
msys.bat
andmingw-w64.bat
, both locate in their respective installation directory. Copy the content inmingw-w64.bat
and paste in the head ofmsys.bat
. Then runmsys.bat
, you can use g++ and gcc, which belongs to mingw. - Now we can compile gsl. Download gsl to the file folder of MSYS.
- In the unix-like terminal, type
tar xzvf gsl-2.4.tar.gz
cd gsl-2.4
./configure
make
make install
When I run ./configure, there is a warning, "WARNING: cache variable lt_cv_path_LD contains a newline". As a result, I fail to run make
. There is a solution libtool. However, after I fix this bug, one more bug about libtool. And there are also mail lists talking about. But I failed to find a solution. I guess these bugs might be incompatible program. Because I choose the latest version when I install mingw_w64, while msys or gsl might not be updated. Then I adopt the mingw32 and mingw64 in Rtools. It need more time to test.
- Download MinGW and install.
- In MinGW Installation Manager, choose all packages in basic setup and install.
- In cmd, type 'msys.bat MSYS' to open a unix-like terminal.
- Download gsl to the file folder of MSYS.
- In the unix-like terminal, type
cd gsl-2.4/
./configure
make
make install
- The lib is in 'local/lib', and the include is in 'local/include'
- Now, you can use gsl on windows.
g++ test.c -o out I"path/to/include" -L"path/to/lib" -lgsl -lgslcblas -lm
NOTE: The include and lib in this repository are just for i386.
-
Choose Tools>Compiler Options, select one 32-bit compiler to configure, say
TDM-GCC 4.8.1 32-bit Release
. DO NOT use 64-bit! -
Choose Tools>Compiler Options>Directories, then add the include and libraries path for gsl.
-
Choose Tools>Compiler Options>General, add the following commands when calling the linker
-lgsl -lgslcblas -lm
- Compile and build a C/C++ program, say lm.cpp
The results are as follows: