catboost/docs/en/installation/build-environment-setup-for-cmake.md
{% note warning %}
{% include ya-make-to-cmake-switch %}
For building {{ product }} using Ya Make see here
{% endnote %}
{% include catboost-src-root %}
{% include cmake-platforms %}
{% include docker-build-env %}
Python 3.x interpreter. Python is used in some auxiliary scripts and conan package manager uses it.
{% cut "Previous requirements" %}
For revisions before 98df6bf python had to have six package installed.
{% endcut %}
Version >= 3.24, < 4.0.
Issue about support for CMake 4.x
{% cut "Previous requirements" %}
Before commit 21a3f85:
| Condition | Supported versions |
|---|---|
| Target OS is Windows, build without CUDA support | >= 3.24, < 4.0 |
| Target OS is Windows, build with CUDA support | >= 3.21, < 4.0 |
| Target OS is Android | >= 3.21, < 4.0 |
| CUDA support, target OS is not Windows | >= 3.18, < 4.0 |
| None of the above | >= 3.15, < 4.0 |
{% endcut %}
Depending on host OS:
{% list tabs %}
Linux
gcc compiler, not used to compile {{ product }} code itself but used to build dependencies as Conan packages.
The supported versions are 18.x - 21.x
Possible version 22.x support depends on the next conan release. See this issue.
lld linker, version 7+
For Linux target the default CMake toolchain assumes that clang, clang++ and ld.lld are available from the command line and will use them to compile and link {{ product }} components. If the default versions of clang, clang++, ld.lld are 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++ and ld.lld with clang-$LLVM_VERSION, clang++-$LLVM_VERSION and ld.lld-$LLVM_VERSION respectively where $LLVM_VERSION is the version of clang or lld you want to use like, for example, 19 or 20 (must be already installed).
For compilation with CUDA support the default CMake toolchain assumes that clang-14 is available from the command line.
{% cut "Previous requirements" %}
For revisions before 38d5db4 supported clang versions for x86_64 architecture have been 16 - 21
For revisions before 8698718 supported clang versions for x86_64 architecture have been 14 - 18
For revisions before 4602574 the minimal supported clang version for aarch64 architecture has been 14.
For revisions before 2347554 the minimal supported clang as a CUDA host compiler version has been 12.
For revisions before 136f14f the minimal supported clang version has been 12.
{% endcut %}
Android target uses its own CMake toolchain and compiler tools specified there are all provided by the NDK.
macOS
clang with version 15+, so XCode version must be greater than 15.0 as well){% cut "Previous requirements" %}
For revisions before 734722c supported clang versions have been 15 - 16 (means XCode version must have been 15.0 - 16.2)
For revisions before 1d5e677 the minimal supported clang version has been 14 (means XCode version must have been 14.0 as well)
For revisions before 136f14f the minimal supported clang version has been 12 (means XCode version must have been 12.0+ as well).
{% endcut %}
Windows
Windows 10 or Windows 11 SDK (usually installed as a part of the Microsoft Visual Studio setup)
for builds without CUDA support:
clang-cl compiler with version 14+ installed (can be selected in Individual components pane of the Visual Studio Installer for Visual Studio 2022). See details herefor builds with CUDA support:
Individual components pane of the Visual Studio Installer for a particular Visual Studio version){% cut "Previous requirements" %}
For revisions before b6b6b3f builds with CUDA required MSVC v142 - Visual Studio 2019 C++ x64/x86 build tools version v14.28 - 16.x or v14.29 - 16.x.
For revisions before 8698718 builds without CUDA required Microsoft Visual Studio 2022 with clang-cl compiler with versions 14 - 18.
For revisions before d5ac776 builds without CUDA have also been using MSVC v142 - Visual Studio 2019 C++ x64/x86 build tools version v14.28 - 16.8 or v14.28 - 16.9.
For revisions before between d5ac776 and 136f14f for builds without CUDA support the minimum supported clang-cl version has been 12 (so, Visual Studio 2019 that includes it has also been supported).
{% endcut %}
{% endlist %}
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).
CUDA versions 11.4 - 12.2 are also supported, but require changing the default list of CUDA architectures for which device code is generated. See the sections on building from source for details.
CUDA 12.3+ support is in progress: GitHub issue #2755.
{% cut "Previous requirements" %}
For revisions before 45cc2e1 the minimal supported CUDA version has been 11.0 .
{% endcut %}
Version 2.4.1+.
{% cut "Previous requirements" %}
For revisions before 21a3f85 versions 1.57.0 - 1.62.0 are supported and version 1.62.0 is required if you use python 3.12+.
{% endcut %}
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
{% list tabs %}
Ninja
Ninja is the preferred build system for CMake.
For Windows builds version 1.13.0 is not supported because of Ninja issue #2616
ninja command should be available from the command line.
Microsoft Visual Studio solutions
{% include cmake-visual-studio-generator %}
Unix Makefiles
{% include cmake-unix-makefiles-generator %}
{% endlist %}
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.
JDK version for CatBoost package for Apache Spark depends on Apache Spark version:
Set JAVA_HOME environment variable to point to the path of JDK installation to be used during build.
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. {{ product }} does not currently support other Python implementations like PyPy, Jython or IronPython.
One convenient way to install different Python versions with development artifacts in one step is to use pyenv (and its variant for Windows - pyenv-win)
Required only to build the python package.
Version 3.0.*, >= 3.0.10
cython command should be available from the command line.
{% cut "Previous requirements" %}
Before revision 7b76b2c an additional installation of Cython had not been needed because internal Cython from contrib had been used.
{% endcut %}
{% cut "Previous requirements" %}
Before revision bdcf319 an additional installation of Numpy had not been needed because internal Numpy from contrib had been used.
{% endcut %}