Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Dotnet Machinelearning Native Build Toolchain

From Leeroopedia


Knowledge Sources
Domains Infrastructure, Native_Code
Last Updated 2026-02-09 11:00 GMT

Overview

CMake 3.20+ and C++11 native build toolchain for compiling ML.NET native libraries (CpuMathNative, FastTreeNative, LdaNative, OneDalNative) across Windows, Linux, and macOS.

Description

ML.NET includes several performance-critical native C/C++ libraries that must be compiled from source. These include CpuMathNative (SSE/AVX math operations), FastTreeNative (gradient boosted decision trees), LdaNative (Latent Dirichlet Allocation), MatrixFactorizationNative (LIBMF wrapper), MklProxyNative (Intel MKL FFT proxy), OneDalNative (Intel oneDAL algorithms), and SymSgdNative (Symbolic SGD). Each has specific CPU instruction set requirements and platform constraints.

Usage

Use this environment when building ML.NET from source or when modifying native C/C++ components. Pre-built NuGet packages include compiled native binaries, so this environment is only needed for development and custom builds.

System Requirements

Category Requirement Notes
OS Windows 10+, Ubuntu 16.04+, macOS 10.13+ macOS deployment target 13.0
Hardware x64 CPU with SSE3 support SSE4.1 required for FastTreeNative
RAM 2GB minimum For native compilation
Disk 10GB+ free Build artifacts and toolchains

Dependencies

Windows

  • `Visual Studio 2019` >= 16.4 (Community, Professional, or Enterprise)
  • `MSVC v142` C++ x64/x86 build tools
  • `MSVC v142` C++ ARM and ARM64 build tools (for cross-compilation)
  • `CMake` >= 3.20 (3.21+ for Visual Studio 2022)
  • C++ Standard: C++11

Linux

  • `git`
  • `clang` >= 3.9
  • `cmake` >= 3.20
  • `libunwind8`
  • `libomp-dev` (OpenMP support)
  • `curl`
  • `libssl` 1.0.0+
  • `libicu` (version varies by distro)

macOS

  • `cmake` >= 3.10.3
  • `libomp` >= 7
  • `gettext`
  • Xcode command line tools

Credentials

No credentials required for native builds.

Quick Install

# Linux (Ubuntu 16.x)
sudo apt-get install git clang-3.9 cmake libunwind8 curl libssl1.0.0 libomp-dev

# macOS
brew update && brew install cmake gettext && brew link gettext --force

# Windows: Install Visual Studio 2019+ with "Desktop development with C++" workload
# Then build with:
# build.cmd

Code Evidence

CMake minimum version from `src/Native/CMakeLists.txt:1`:

cmake_minimum_required(VERSION 3.20)

C++11 standard from `src/Native/CMakeLists.txt:9`:

set(CMAKE_CXX_STANDARD 11)

SSE3 requirement for CpuMathNative from `src/Native/CpuMathNative/CMakeLists.txt:10`:

add_compile_options(-msse3)

SSE4.1 requirement for FastTreeNative from `src/Native/FastTreeNative/CMakeLists.txt:14`:

add_compile_options(-msse4.1)

MSVC minimum version check from `src/Native/CpuMathNative/CMakeLists.txt:16`:

if (MSVC_VERSION GREATER 1900)

macOS deployment target from `src/Native/CMakeLists.txt:116`:

set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0")

Platform-specific library extensions from `Directory.Build.targets:13-16`:

<!-- Windows: .dll, Linux: .so, macOS: .dylib -->

Common Errors

Error Message Cause Solution
`CMake Error: CMAKE_C_COMPILER not set` C compiler not found Install clang-3.9 or MSVC build tools
`SSE3/SSE4.1 not supported` Old CPU without required SIMD instructions Use a CPU with at least SSE4.1 support (most CPUs since 2006)
`cannot find -lunwind` libunwind not installed on Linux `sudo apt-get install libunwind8`
`libomp not found` OpenMP library missing Linux: `sudo apt-get install libomp-dev`; macOS: `brew install libomp`

Compatibility Notes

  • ARM/ARM32: Builds with `-mthumb -fPIC -march=armv7-a` flags but excludes MklImports, CpuMathNative, FastTreeNative, SymSgdNative, MklProxyNative, and libiomp5md modules.
  • ARM64: OneDalNative is excluded (requires x64).
  • macOS Intel x64: Native dependency support is being deprecated as Intel discontinues x64 Macs.
  • Windows x86: Builds with `/Gz` (stdcall) convention and `LARGEADDRESSAWARE` linker flag for >2GB address space.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment