Skip to content

Conversation

asp2286
Copy link

@asp2286 asp2286 commented Sep 10, 2025

macOS: Only build OneDalNative when oneDAL headers & libs are configured (fixes macOS x64 build)

Problem
On macOS x64, building src/Native fails with:

fatal error: 'daal.h' file not found

The oneDAL “devel” (headers) package is not available via NuGet for osx-x64, so locally ONEDAL_DEVEL_PATH is not present and OneDalNative cannot compile. Today the native CMake unconditionally includes OneDalNative on x64, which makes a default macOS developer build fail.

What this PR changes

  • Gate add_subdirectory(OneDalNative) behind explicit configuration:
    • Only include OneDalNative when both ONEDAL_DEVEL_PATH and ONEDAL_REDIST_PATH are defined and ${ONEDAL_DEVEL_PATH}/include/daal.h exists.
    • Otherwise, print an informative message(STATUS ...) and skip OneDalNative.

Why this is safe

  • Windows/Linux CI builds that pass ONEDAL_* continue to build OneDalNative unchanged.
  • macOS builds (where oneDAL headers aren’t available via NuGet by default) no longer fail—they build the rest of the native components and skip OneDalNative.
  • No changes to build.sh are required. The script already sets -DONEDAL_* only when callers pass the corresponding command-line switches.

Repro (before)

# macOS x64 without oneDAL headers
cmake ... && make
# -> OneDalNative/OneDalAlgorithms.cpp: fatal error: 'daal.h' file not found

Behavior (after)

  • If ONEDAL_* not provided: CMake prints Skipping OneDalNative: ONEDAL_DEVEL_PATH/ONEDAL_REDIST_PATH not set and the rest builds fine.
  • If ONEDAL_* provided and ${ONEDAL_DEVEL_PATH}/include/daal.h exists: OneDalNative builds as before.

Test matrix

  • ✅ macOS x64 (Intel): builds successfully; OneDalNative skipped by default; other native targets build.
  • ✅ macOS arm64 (Apple Silicon): previously didn’t include OneDalNative (arch guard); behavior unchanged.
  • ✅ Linux/Windows (CI): when ONEDAL_* are set (as in existing pipelines), behavior unchanged and OneDalNative builds.

Notes

  • This PR intentionally doesn’t alter OpenMP handling or SymSgdNative. On macOS x64, developers who need SymSgdNative can use Homebrew LLVM (brew install llvm libomp) or provide appropriate OpenMP flags; that is orthogonal to oneDAL headers availability.
  • We can later add an explicit -DMLNET_BUILD_ONEDAL=ON/OFF flag for stricter control if maintainers prefer.

@asp2286
Copy link
Author

asp2286 commented Sep 10, 2025

Reviewer checklist (suggested)

Scope & Risk

  • Change limited to src/Native/CMakeLists.txt only (no code changes).
  • Behavior unchanged when ONEDAL_* are provided (Windows/Linux CI).
  • macOS local builds no longer fail by default (OneDalNative skipped).

Build verification

  • macOS x64 (no ONEDAL_* set): cmake && make succeeds; CMake prints STATUS "Skipping OneDalNative...".
  • macOS arm64: behavior unchanged (OneDalNative was not built before).
  • Windows/Linux with ONEDAL_* (CI or local): OneDalNative builds as before.

CMake output sanity

  • STATUS message shows when skipping OneDalNative.
  • When ONEDAL_* are provided and ${ONEDAL_DEVEL_PATH}/include/daal.h exists, OneDalNative target is present.

Documentation / Notes

  • PR description explains context (NuGet lack of oneDAL headers on osx-x64) and rationale.
  • Commit message is clear and references macOS build fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant