Build environment setup for CMake
- Native artifacts build requirements
For building CatBoost using Ya Make see here
Later in this document
$CATBOOST_SRC_ROOT refers to the root dir of the local working copy of the source code cloned from the GitHub CatBoost repository.
Host platform refers to the operating system and CPU architecture you run build on.
Target platform refers to the operating system and CPU architecture you run build for (where you intend to run built artifacts like executable CLI application, dynamic library, Python extension library etc.)
Possible host and target platform combinations:
|Host platform||Target platform|
|Linux x86_64||Linux or Android|
|Linux non x86_64||Linux|
|macOS x86_64 or arm64||macOS x86_64 or arm64 or universal binaries|
|Windows x86_64||Windows x86_64|
Native artifacts build requirements
|Target OS is Windows||3.21|
|Target OS is Android||3.21|
|CUDA support is enabled||3.18|
|None of the above||3.15|
Android NDK (only for Android target platform)
Compilers, linkers and related tools
Depending on host OS:
gcccompiler, not used to compile CatBoost code itself but used to build dependencies as Conan packages.
clangcompiler, version 12+
lldlinker, version 7+
For Linux target the default CMake toolchain assumes that
clang++ are available from the command line and will use them to compile CatBoost components. If the default version of
clang++ is not what is intended to be used for building then modify the toolchain file
$CATBOOST_SRC_ROOT/build/toolchains/clang.toolchain - replace all occurences of
clang++-$CLANG_VERSION respectively where
$CLANG_VERSION is the version of
clang you want to use like, for example,
14 (must be already installed).
Android target uses its own CMake toolchain and compiler tools specified there are all provided by the NDK.
- XCode command line tools (must contain
clangwith version 12+, so XCode version must be greater than 12.0 as well)
- Windows 10 or Windows 11 SDK (usually installed as a part of the Microsoft Visual Studio setup)
- MSVC v142 - VS 2019 C++ x64/x86 build tools version v14.28 - 16.8 or v14.28 - 16.9 (can be selected in
Individual componentspane of the Visual Studio Installer for Visual Studio 2019)
CUDA toolkit (only if CUDA support is needed)
Supported only for Linux and Windows host and target platforms.
CUDA toolkit needs to be installed.
CUDA version 11.8 is supported by default (because it contains the biggest set of supported target CUDA compute architectures).
Other CUDA versions (11.0+) can also be used but require changing target compute architecture options in affected CMake targets.
Version 1.57.0 - 1.59.0. Version 2.x support is in progress.
Used for some dependencies.
conan command should be available from the command line.
Make sure that the path to Conan cache does not contain spaces, this causes issues with some projects. Default cache location can be overridden by specifying
CONAN_USER_HOME environment variable
Used as a build system for CMake.
ninja command should be available from the command line.
Alternatively, on Windows you could also use
Visual Studio 16 2019 generator for CMake. In this case also specify the required toolset version when calling CMake by adding
-T version=14.28 to the command line.
Unix Makefiles CMake generator usage on macOS and Linux is possible but not recommended because of some issues with properly taking dependencies into account.
JDK (only for components with JVM API)
You have to install JDK to build components with JVM API (JVM applier and CatBoost for Apache Spark).
JDK version has to be 8+ for JVM applier or strictly 8 for CatBoost for Apache Spark.
JAVA_HOME environment variable to point to the path of JDK installation to be used during build.
Python development artifacts (only for Python package)
You have to install Python development artifacts (Python headers in an include directory and Python library for building modules).
Note that they are specific to CPython Python implementation. CatBoost does not currently support other Python implementations like PyPy, Jython or IronPython.
Node environment (only for Python package visualization widget)
You have to have
Yarn package manager is also required.