-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Comments
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? |
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. |
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. |
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. |
Interesting .. I thought it works fine with macOS 11. Because in our pipeline we set MACOSX_DEPLOYMENT_TARGET to '11.0'. |
Our binaries were built on macOS 12 with XCode 14.2. |
Could it because your macOS SDK version is too new? |
It's possible. I will try and get an older SDK tomorrow and see if compiling against that makes any difference |
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details. |
Two things are required to make this work. This condition needs to be tighter about usage of std::chrono for macOS. The SDK version must be > 14.4 as per the current check, but the min version must also be >= 13.3. onnxruntime/include/onnxruntime/core/common/logging/logging.h Lines 61 to 68 in 904b850
Something like this might work for a macOS build. Not sure if additional conditions are required for iOS/mac-catalyst. // Xcode added support for C++20's std::chrono::operator<< in SDK version 14.4, but the target macOS version must be
// >= 13.3 for it to be used.
#if __cplusplus >= 202002L && \
(!defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 140400L) && \
(!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED>= 130300L)
namespace timestamp_ns = std::chrono;
#else
namespace timestamp_ns = ::date;
#endif Additionally there needs to be disambiguation of That can be done by explicitly outputting the timestamp as a first step like this: timestamp_ns::operator<<(msg, timestamp);
msg << " [" << message.SeverityPrefix() << ":" << message.Category() << ":" << logger_id << ", "
<< message.Location().ToString() << "] " << message.Message(); |
It got a little bit more complicated to handle mac-catalyst as well, but hopefully #22138 fixes this completely. |
### Description Fix usage of c++ std::chrono::operator<< in mac builds for wider range of xcode/targets. ### Motivation and Context #21033
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
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
The text was updated successfully, but these errors were encountered: