-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
(doc): set cmake c++ compatible standard when building on MacOS CPU. #23483
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds documentation for a workaround to a build issue on macOS related to the C++ standard. While adding this troubleshooting guide is helpful for users who might encounter this, a more robust solution would be to address the root cause in the build configuration itself. I recommend updating cmake/cpu_extension.cmake
to enforce the required C++ standard, for instance by adding set(CMAKE_CXX_STANDARD 17)
. This would prevent the issue from occurring in the first place and provide a smoother experience for developers building on macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On macOS, the system compiler is typically Clang, not GCC. Mentioning "old GCC standard" could be misleading for users on this platform. To improve clarity and accuracy, I recommend referring to the C++ standard more generally.
For example:
**Solution**: Your compiler might be using an older C++ standard. Edit `cmake/cpu_extension.cmake` and add `set(CMAKE_CXX_STANDARD 17)` before `set(CMAKE_CXX_STANDARD_REQUIRED ON)`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea! updated now
Signed-off-by: teekenl <teekenlau@gmail.com>
4019b59
to
475eebc
Compare
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding this troubleshooting tip!
…llm-project#23483) Signed-off-by: teekenl <teekenlau@gmail.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Purpose
When building source on MacOS (CPU), encountered compilation
error: 'constexpr' is not a type
, that because clang is defaulting to old c++ standard that seem not able to compile specific syntax properly.Test Plan
Test Result
(Optional) Documentation Update
Add troubleshotting solution on
docs/getting_started/installation/cpu/apple.inc.md
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.