Installing the GNU Scientific Library (GSL)
Source:vignettes/gsl_installation.Rmd
gsl_installation.Rmd
macOS
Using Homebrew
-
Install
Homebrew
if it’s not installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Update
Homebrew
package list:
brew update
- Install GSL
brew install gsl
Using MacPorts
Install MacPorts if it’s not installed: Follow the installation guide on the MacPorts website.
Update MacPorts package list:
sudo port selfupdate
- Install GSL:
sudo port install gsl
Compiling from Source
Download the source code: Download the GSL source code from the official website.
Unzip and navigate to the folder:
tar -xzf gsl-x.y.z.tar.gz
cd gsl-x.y.z
Replace x.y.z
with the version number.
- Configure and make:
./configure
make
sudo make install
Windows
Installing the GNU Scientific Library (GSL) on Windows can be a bit more challenging compared to Linux or macOS.
Using MSYS2
Install MSYS2: Download and install MSYS2 from the official site.
Update Package Database and Core System Packages: Open MSYS2 and run the following commands to update the package database and core system packages.
pacman -Syu
After this, close MSYS2 and open it again.
- Update Remaining Packages: Run the following command to update the remaining packages:
pacman -Su
- Install GSL: To install GSL, run:
pacman -S mingw-w64-x86_64-gsl
Using vcpkg (For Visual Studio)
-
Clone vcpkg: First, you’ll need to clone the
vcpkg
repository and then bootstrap it.
git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
- Install GSL: To install GSL, run:
vcpkg install gsl:x64-windows
Or for 32-bit,
vcpkg install gsl:x86-windows
-
Integrate with Visual Studio: To integrate
vcpkg
libraries with Visual Studio, you can run:
vcpkg integrate install
Linux system
From Source
You can also compile GSL from source code on any Linux distribution:
Download the source code: You can download the GSL source code from the official website.
Extract and navigate to the folder:
tar -xzf gsl-x.y.z.tar.gz
cd gsl-x.y.z
Replace x.y.z
with the version number.
- Configure, make, and install:
./configure
make
sudo make install
After installation, you should be able to use the GSL in your
development projects. The library and header files are generally placed
in standard locations (/usr/lib/
,
/usr/include/
, etc.), so you should not need to make any
special arrangements to use them in your projects.