Skip to content

[Build] Build script for MacOS fails for targets older than 13.4 because tests can not be built #24277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
juhanisimola-yousician opened this issue Apr 2, 2025 · 7 comments
Labels
build build issues; typically submitted using template

Comments

@juhanisimola-yousician
Copy link

Describe the issue

According to https://onnxruntime.ai/docs/build/inferencing.html, "By default, ONNX Runtime is configured to be built for a minimum target macOS version of 10.12." In practice, when the runtime is built without specifying a target OS it is built for the major OS version the build machine is running (15.0 when building on 15.4 in my case). When the --apple_deploy_target argument is set to anything less than 13.4, the build fails because the tests are using functionality that is not available on older MacOS versions. The runtime itself is compiled, but I couldn't find an option to disable building the tests.

Urgency

No response

Target platform

MacOS

Build script

./build.sh --cmake_generator Ninja --config Release --skip_submodule_sync --skip_tests --build_shared_lib --apple_deploy_target 10.15 --minimal_build --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="x86_64;arm64" CMAKE_IGNORE_PATH=/opt/homebrew

Error / output

The first error is

In file included from /Users/juhani.simola/work/onnxruntime-1.21.0/onnxruntime/test/common/logging/sinks_test.cc:3:
In file included from /Users/juhani.simola/work/onnxruntime-1.21.0/include/onnxruntime/core/common/common.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/chrono:969:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__chrono/formatter.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__chrono/ostream.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/format_functions.h:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_floating_point.h:74:30: error: 'to_chars' is unavailable: introduced in macOS 13.4
  to_chars_result __r = std::to_chars(__first, __last, __value, __fmt, __precision);

Visual Studio Version

No response

GCC / Compiler Version

Xcode 15.4 and 16.3, SDK 16.3

@juhanisimola-yousician juhanisimola-yousician added the build build issues; typically submitted using template label Apr 2, 2025
@juhanisimola-yousician
Copy link
Author

Oh well. x86_64 build fails with Xcode 16.3 because of this too:

In file included from /Users/juhani.simola/work/onnxruntime-1.21.0/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx512vnni.cpp:26:
In file included from /Users/juhani.simola/work/onnxruntime-1.21.0/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx512_int8_blklen16.h:9:
In file included from /Users/juhani.simola/work/onnxruntime-1.21.0/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx512_int8_blklen32.h:8:
/Users/juhani.simola/work/onnxruntime-1.21.0/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h:954:49: error: array index 4 is past the end of the array (that has type '__m256[4]') [-Werror,-Warray-bounds]
  954 |                 __m128 acc_1 = FoldAccumulators(acc[4], acc[5], acc[6], acc[7]);

@snnn
Copy link
Member

snnn commented Apr 2, 2025

Please use an older version of ONNX Runtime, or increase the target OS version.

@snnn snnn closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2025
@snnn snnn reopened this Apr 2, 2025
@snnn
Copy link
Member

snnn commented Apr 2, 2025

Our packaging pipeline set MACOSX_DEPLOYMENT_TARGET to be 13.3 and it works well:
https://github.com/microsoft/onnxruntime/blob/main/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml#L34

But you were saying 13.4 . Probably it is an SDK issue? Our pipelines use XCode 15.3.0. Yours are newer.

@snnn
Copy link
Member

snnn commented Apr 2, 2025

It is related to PR #17361 , which increased the min MacOS version to 13.3.

@juhanisimola-yousician
Copy link
Author

juhanisimola-yousician commented Apr 3, 2025

I doubt that Apple has retroactively removed std::to_chars from macOS 13.3 when they released SDK 16. In the past I've seen that code that used std::filesystem::path compiled when targeting older macOS versions (10.14 IIRC) but didn't work, and later SDKs declared it unavailable on those versions. Are you running the tests on macOS 13.3?

@lumpidu
Copy link

lumpidu commented Apr 10, 2025

I can confirm increasing "--apple_deploy_target=13.4" from 13.3 fixes the issue. However I encounter the same error as @juhanisimola-yousician for compilation of mlas.

(And btw. cmake 4.0 as now the default on Homebrew also doesn't work opposed to the Releases notes.)

@snnn
Copy link
Member

snnn commented Apr 10, 2025

The mlas issue is the same as #23180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants