Skip to content
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

v1.17.0 + requires macOS deployment target >= than 13.3 due to C++ 20 #21033

Open
ola-ableton opened this issue Jun 13, 2024 · 9 comments
Open
Labels
api issues related to all other APIs: C, C++, Python, etc.

Comments

@ola-ableton
Copy link

ola-ableton commented Jun 13, 2024

Describe the issue

It seems that moving to C++20 for macOS builds has bumped the minimum macOS that the library can run on. I didn't see this mentioned in the release notes. macOS 13.3 is not that old.

https://stackoverflow.com/questions/76932735/unable-to-use-to-chars-with-clang-on-macos

In file included from /onnxruntime/onnxruntime/include/onnxruntime/core/common/common.h:23:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/chrono:800:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__chrono/formatter.h:23:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__chrono/ostream.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__format/format_functions.h:29:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__format/formatter_floating_point.h:73:32: error: 'to_chars' is unavailable: introduced in macOS 13.3
  to_chars_result __r = _VSTD::to_chars(__first, __last, __value, __fmt, __precision);

To reproduce

try and compile explicitly setting a lower deployment target with --apple_deploy_target

Urgency

No response

Platform

Mac

OS Version

11

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.17.0

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

@ola-ableton
Copy link
Author

0141e27

@ola-ableton ola-ableton changed the title v1.18.0 requires macOS deployment target >= than 13.3 due to C++ 20 v1.17.0 + requires macOS deployment target >= than 13.3 due to C++ 20 Jun 13, 2024
@snnn
Copy link
Member

snnn commented Jun 13, 2024

So, you were not using our official packages, you built the binaries from source by yourself and you didn't use the "--apple_deploy_target" flag?

@ola-ableton
Copy link
Author

I am building a custom build but I did use the -apple_deploy_target.

We need to support macOS 11 or higher but if you specify

-apple_deploy_target=11.0

the build will fail with the above error

It's necessary to set at least

-apple_deploy_target=13.3

for the C++ 20 code to compile.

This will be a problem for many other users I imagine. Fortunately we can stay on version 1.16.3 which is the last release that didn't require C++ 20 on macOS.

@snnn
Copy link
Member

snnn commented Jun 13, 2024

As long as you need to deploy the code to a different machine, you always need to set the deploy target's OS version. No matter what ONNX Runtime version you use, or no matter the target OS is Windows or MacOS. Because there is no other way to get this information.

@snnn snnn closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@ola-ableton
Copy link
Author

I understand that you need to set the deploy target to the minimum OS that you want to support. That wasn't the reason for my issue.

Since 0141e27 onnxruntime can only target macOS 13.3 or higher due to the introduction of C++ 20 for macOS. That really limits the machines that are supported since macOS 13.3 is not that old. Many users don't upgrade their operating systems regularly, apple still supports macOS 12 for instance - https://endoflife.date/macos.

This limitation is not mentioned in the commit or the release notes for onnxruntime 1.17.0 or higher.

Perhaps this issue doesn't appear if you compile against a different macOS SDK. I have been compiling against the 14.5 SDK that comes with the latest stable Xcode, but if i am not mistaken I don't think your onnxruntime builds of 1.17.0 + are suitable for macOS < 13.3. If that is intended, then it should be mentioned in the release notes. If it's not intended then maybe it's worth reconsidering if it's necessary to compile with C++20 just on macOS, since the other platforms don't use it yet.

I'm happy to be corrected if I am wrong here. Thanks for your work maintaining onnxruntime.

@snnn snnn reopened this Jun 13, 2024
@snnn
Copy link
Member

snnn commented Jun 13, 2024

Interesting .. I thought it works fine with macOS 11. Because in our pipeline we set MACOSX_DEPLOYMENT_TARGET to '11.0'.
See: https://github.com/microsoft/onnxruntime/blob/main/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml#L34

@snnn
Copy link
Member

snnn commented Jun 13, 2024

Our binaries were built on macOS 12 with XCode 14.2.
https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
If it doesn't support macOS 12, we wouldn't be able to run the tests.

@snnn
Copy link
Member

snnn commented Jun 13, 2024

Could it because your macOS SDK version is too new?

@ola-ableton
Copy link
Author

It's possible. I will try and get an older SDK tomorrow and see if compiling against that makes any difference

@sophies927 sophies927 added the api issues related to all other APIs: C, C++, Python, etc. label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api issues related to all other APIs: C, C++, Python, etc.
Projects
None yet
Development

No branches or pull requests

3 participants