This is the guide for the build of GPBoost command line interface (CLI) version. For building the Python and R packages, please refer to Python-package and R-package.
All instructions below are aimed for compiling a 64-bit version. It is worth to compile 32-bit version only in very rare special cases of environmental limitations. 32-bit version is slow and untested, so use it on your own risk and don't forget to adjust some commands in this guide.
On Windows LightGBM can be built using
- CMake and VS Build Tools or Visual Studio
- CMake and MinGW
Install Git for Windows, CMake (3.8 or higher) and VS Build Tools (VS Build Tools is not needed if Visual Studio (2015 or newer) is already installed).
Run the following commands:
git clone --recursive https://github.com/fabsig/GPBoost cd GPBoost mkdir build cd build cmake -A x64 .. cmake --build . --target ALL_BUILD --config Release
Note: sometimes running cmake -A x64 ..
gives an error Generator X does not support platform specification, but platform x64 was specified.
In this case, you need to explicitly provide the generator, for instance:
cmake -G "Visual Studio 17 2022" ..
The .exe
and .dll
files will be in the GPBoost/Release
folder.
Install Git for Windows, CMake and MinGW-w64.
Run the following commands:
git clone --recursive https://github.com/fabsig/GPBoost cd LightGBM mkdir build cd build cmake -G "MinGW Makefiles" .. mingw32-make.exe -j4
The .exe
and .dll
files will be in the GPBoost/
folder.
Note: You may need to run the cmake -G "MinGW Makefiles" ..
one more time if you encounter the sh.exe was found in your PATH
error.
On Linux GPBoost can be built using CMake and gcc or Clang.
Install CMake.
Run the following commands:
git clone --recursive https://github.com/fabsig/GPBoost cd GPBoost mkdir build cd build cmake .. make -j4
Note: glibc >= 2.14 is required.
Note: In some rare cases you may need to install OpenMP runtime library separately (use your package manager and search for lib[g|i]omp
for doing this).
On macOS GPBoost can be built using CMake and Apple Clang or gcc.
Only Apple Clang version 8.1 or higher is supported.
Install CMake (3.16 or higher):
brew install cmake
Install OpenMP:
brew install libomp
Run the following commands:
git clone --recursive https://github.com/fabsig/GPBoost cd GPBoost mkdir build cd build cmake .. make -j4
Install CMake (3.2 or higher):
brew install cmake
Install gcc:
brew install gcc
Run the following commands:
git clone --recursive https://github.com/fabsig/GPBoost cd GPBoost export CXX=g++-7 CC=gcc-7 # replace "7" with version of gcc installed on your machine mkdir build cd build cmake .. make -j4