Build from source using Maven

Dependencies and requirements

Warning

CatBoost uses CMake-based build process since this commit. Previously Ya Make (Yandex's build system) had been used.

Select the appropriate build environment setup below accordingly.

  • Linux, macOS or Windows.

  • Set up build environment depending on build type:

  • Python. 3.6+

  • Maven 3.3.9+

  • JDK 8+

    Set JAVA_HOME environment variable to point to the path of JDK installation

CUDA support

CUDA support is available for Linux and Windows target platforms.
It is disabled by default and can be enabled by adding --have-cuda flag to buildNative.extraArgs definition. See below for details.

CUDA architectures to generate device code for are specified using CMAKE_CUDA_ARCHITECTURES variable, although the default value is non-standard, specified in cuda.cmake. The default value is intended to provide broad GPU compatibility and supported only when building with CUDA 11.8.
The most convenient way to override the default value is to use CUDAARCHS environment variable.

Building steps

  1. Clone the repository:

    git clone https://github.com/catboost/catboost.git
    
  2. Go to the catboost/catboost/jvm-packages/catboost4j-prediction directory from the local copy of the CatBoost repository.

  3. Use the usual maven build phases in this directory.

    Additional flags for building native dynamic library part can specified using buildNative.extraArgs definition.
    Supported flags are:

    • --build-system=<build_system>. Supported values are CMAKE (default), YA.
    • --build-type=<build_type>. Supported values are Release (default), Debug.
    • --have-cuda. Add to enable CUDA support.
      Example running tests with this definition:
    mvn test -DbuildNative.extraArgs="--build-type=Debug"
    
Previous