Hi,
I have codelite v 12.0.4.
How do install and use GNU scientific library in codelite?
Please kindly assist.
gsl library
-
- CodeLite Curious
- Posts: 6
- Joined: Fri Dec 09, 2016 5:04 am
- Genuine User: Yes
- IDE Question: "C"
- Contact:
-
- CodeLite Curious
- Posts: 5
- Joined: Fri May 05, 2017 10:25 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: gsl library
You have to download the source, compile it, and then configure the project so that it finds the header files and the compiled library. In which step do you need assistance?
-
- CodeLite Curious
- Posts: 6
- Joined: Fri Dec 09, 2016 5:04 am
- Genuine User: Yes
- IDE Question: "C"
- Contact:
Re: gsl library
Thank you very much.
Please advise how to compile the gsl library first.
Please advise how to compile the gsl library first.
-
- CodeLite Curious
- Posts: 5
- Joined: Fri May 05, 2017 10:25 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: gsl library
The GSL, as many other libraries, is prepared to be compiled by the typical toolchain of UNIX systems (bash, autoconf, autotools, make, gcc, etc), with few instructions that generate automatic makefiles and put all files in the proper place. In the directory where the source files have been downloaded you run
$ ./configure
$ make
$ make install
and that's it. (Well, essentially; `configure` can take different parameters).
If you are using Linux or a similar OS, that's all. If you are using Windows, the procedure is longer. If this is your case, I can give you detailed instructions.
$ ./configure
$ make
$ make install
and that's it. (Well, essentially; `configure` can take different parameters).
If you are using Linux or a similar OS, that's all. If you are using Windows, the procedure is longer. If this is your case, I can give you detailed instructions.
-
- CodeLite Curious
- Posts: 6
- Joined: Fri Dec 09, 2016 5:04 am
- Genuine User: Yes
- IDE Question: "C"
- Contact:
Re: gsl library
Thanks LinusKer.
I am using Windows. please advise.
I am using Windows. please advise.
-
- CodeLite Curious
- Posts: 5
- Joined: Fri May 05, 2017 10:25 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: gsl library
There are two ways to compile a library for Windows:
1. Use the tools provided by a Windows C/C++ compiler (gcc for instance) and a Windows console. I successfully compiled wxWidgets 3.0 in this way, though I walked a long trial-and-error path. With wxWidgets 3.1 was a little easier.
2. Use the usual UNIX tools (ported to Windows). I compiled GSL 2.5 in this way and it worked perfectly fine. I recommend it, because you can reuse those UNIX tools in other library compilations or in other jobs.
So, I will explain the second way, which involves two steps: 1) Install the UNIX tools; 2) Use them to compile GSL.
Step 1:
The UNIX tools are provided by MSYS2 (it means "Minimal SYStem"; the "2" has to do with a previous MSYS, now obsolete). Download it from http://www.msys2.org. There are alternatives, but I think MSYS2 is best for our purposes.
MSYS2 will install three minimal UNIX subsystems, each with its corresponding package repository, and a console interface.
Download the self-install file `msys2-x86_64_.....exe` (or the one with `i868` in the name if you have a Windows of 32bits). Choose a short directory, like `C:\msys64`. You will find and entry `MSYS2 64bit` in the Windows start menu with subentries `MSYS2 MinGW 32-bit`, `MSYS2 MinGW 64-bit`, `MSYS2 MSYS`.
The entries start three almost identical consoles (except for the prompt), but they have behind different UNIX subsystems, with different paths. For instance, the included compiler `gcc` is different in the three subsystems. Running `gcc` in the console `MSYS`, it will produce a UNIX executable; the one in the `MinGW32` console will produce a 32 bits Windows executable; the one in the `MinGW64`, a 64 bits Windows executable. The last alternative is possibly what you want; let us assume so.
We also need to install packages that do not come with the initial MSYS2 installation. The package manager that comes with MSYS2 is called `pacman`. Use it from the MSYS console; from there you can install packages for the three subsystems. Run
Close the console and open it again. Run the same command until it says there is nothing to update. Then do
You can install the four packages one by one if you prefer. The switch `-S` is for install, and `--needed` is to skip the installation if the package is already installed. If you want to develop also for 32bit machines from your 64bit machine, then you also need to install the corresponding packages with `i686` instead of `x86_64`.
Add to the windows system path `C:\msys64\mingw64\bin` (or `C:\msys64\mingw32\bin` to give priority to the compiler that produces 32bit executables), so that you can use `gcc` directly from your working directory later. (You may already have a gcc compiler for Windows in your system; if you want to use it instead, forget this paragraph; for your information, on 2018-11-01, MSYS2 has installed gcc version 8.2.0 in the MinGW64 subsystem.)
For more information on MSYS2, see the MSYS2 Wiki: https://github.com/msys2/msys2/wiki
Step 2:
Download `gsl-latest.tar.gz` from ftp://ftp.gnu.org/gnu/gsl or http://www.gnu.org/software/gsl (or one of the older versions therein, if you need to).
Put it in the `home/user` directory of the MSYS2 susbsystem (which corresponds to the Windows path `C:\msys64\home\user`).
Open the console of the MinGW64 susbsystem. (Again, assuming that you intend to produce 64bit executables; if you want 32bit ones, use the MinGW32 console). Run
This will "untar" the file to the subdirectory `gsl-2.5` (or similar name).
The last two instructions will make the result of the compilation go to a different directory from that of the sources, which is more clean, but not mandatory. Let's assume you do it.
Then you can proceed to the compilation itself with the UNIX tools. Run
The `--prefix` is the directory where we want to send the header files and the compiled libraries. It can be anything, provided there are no blanks, accented letters, etc).
The `--enable-shared` switch makes the compiler produce the dynamic (aka shared) libraries (.dll files). Without it, it will produce the static ones (.a files). You probably want to have both, so run the three commands twice, with and without the switch.
That's it. To compile your program using the library GSL you must specify in the compiling command the switch for the location of the include files `-IC:/Progs/gsl-2.5/include` and, in the linking, the switch for the location of the libraries `-LC:/Progs/gsl-2.5/lib` and then the actual linkage `-lgsl -lgslcblas`.
Let us know if it worked for you.
Linus.
1. Use the tools provided by a Windows C/C++ compiler (gcc for instance) and a Windows console. I successfully compiled wxWidgets 3.0 in this way, though I walked a long trial-and-error path. With wxWidgets 3.1 was a little easier.
2. Use the usual UNIX tools (ported to Windows). I compiled GSL 2.5 in this way and it worked perfectly fine. I recommend it, because you can reuse those UNIX tools in other library compilations or in other jobs.
So, I will explain the second way, which involves two steps: 1) Install the UNIX tools; 2) Use them to compile GSL.
Step 1:
The UNIX tools are provided by MSYS2 (it means "Minimal SYStem"; the "2" has to do with a previous MSYS, now obsolete). Download it from http://www.msys2.org. There are alternatives, but I think MSYS2 is best for our purposes.
MSYS2 will install three minimal UNIX subsystems, each with its corresponding package repository, and a console interface.
Download the self-install file `msys2-x86_64_.....exe` (or the one with `i868` in the name if you have a Windows of 32bits). Choose a short directory, like `C:\msys64`. You will find and entry `MSYS2 64bit` in the Windows start menu with subentries `MSYS2 MinGW 32-bit`, `MSYS2 MinGW 64-bit`, `MSYS2 MSYS`.
The entries start three almost identical consoles (except for the prompt), but they have behind different UNIX subsystems, with different paths. For instance, the included compiler `gcc` is different in the three subsystems. Running `gcc` in the console `MSYS`, it will produce a UNIX executable; the one in the `MinGW32` console will produce a 32 bits Windows executable; the one in the `MinGW64`, a 64 bits Windows executable. The last alternative is possibly what you want; let us assume so.
We also need to install packages that do not come with the initial MSYS2 installation. The package manager that comes with MSYS2 is called `pacman`. Use it from the MSYS console; from there you can install packages for the three subsystems. Run
Code: Select all
$ pacman -Syuu
Close the console and open it again. Run the same command until it says there is nothing to update. Then do
Code: Select all
$ pacman -S --needed base-devel
mysys2-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
You can install the four packages one by one if you prefer. The switch `-S` is for install, and `--needed` is to skip the installation if the package is already installed. If you want to develop also for 32bit machines from your 64bit machine, then you also need to install the corresponding packages with `i686` instead of `x86_64`.
Add to the windows system path `C:\msys64\mingw64\bin` (or `C:\msys64\mingw32\bin` to give priority to the compiler that produces 32bit executables), so that you can use `gcc` directly from your working directory later. (You may already have a gcc compiler for Windows in your system; if you want to use it instead, forget this paragraph; for your information, on 2018-11-01, MSYS2 has installed gcc version 8.2.0 in the MinGW64 subsystem.)
For more information on MSYS2, see the MSYS2 Wiki: https://github.com/msys2/msys2/wiki
Step 2:
Download `gsl-latest.tar.gz` from ftp://ftp.gnu.org/gnu/gsl or http://www.gnu.org/software/gsl (or one of the older versions therein, if you need to).
Put it in the `home/user` directory of the MSYS2 susbsystem (which corresponds to the Windows path `C:\msys64\home\user`).
Open the console of the MinGW64 susbsystem. (Again, assuming that you intend to produce 64bit executables; if you want 32bit ones, use the MinGW32 console). Run
Code: Select all
$ tar -xf gsl-latest.tar.gz
This will "untar" the file to the subdirectory `gsl-2.5` (or similar name).
Code: Select all
$ cd gsl-2.5
$ mkdir build
$ cd build
Then you can proceed to the compilation itself with the UNIX tools. Run
Code: Select all
$ ../configure --prefix=C:\Progs\gsl-2.5 --enable-shared
$ make
$ make install
The `--enable-shared` switch makes the compiler produce the dynamic (aka shared) libraries (.dll files). Without it, it will produce the static ones (.a files). You probably want to have both, so run the three commands twice, with and without the switch.
That's it. To compile your program using the library GSL you must specify in the compiling command the switch for the location of the include files `-IC:/Progs/gsl-2.5/include` and, in the linking, the switch for the location of the libraries `-LC:/Progs/gsl-2.5/lib` and then the actual linkage `-lgsl -lgslcblas`.
Let us know if it worked for you.
Linus.
-
- CodeLite Curious
- Posts: 6
- Joined: Fri Dec 09, 2016 5:04 am
- Genuine User: Yes
- IDE Question: "C"
- Contact:
Re: gsl library
Thank you LinusKer. I will give it a go and let you know.
Apologies i forgot to mention that my programming language of choice is C and not C++.
Apologies i forgot to mention that my programming language of choice is C and not C++.