This is an archive of the discontinued LLVM Phabricator instance.

[runtimes] Fixes building with CMake 3.26.
AbandonedPublic

Authored by Mordante on Mar 8 2023, 9:57 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Restricted Project
Summary

Using -nostdinc++ as a linker flag in CMake 3.26 will cause compilation
failures due to -Wunused-command-line-argument. This causes several
compiler flags to be rejected. This will cause libunwind to refuse to
build since its required flags aren't supported by the compiler.

Note CMake 3.26 has not been released yet. This has been tested with
RC5. CMake 3.26 is used to test with C++ modules in libc++.

Diff Detail

Event Timeline

Mordante created this revision.Mar 8 2023, 9:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 9:57 AM
Mordante requested review of this revision.Mar 8 2023, 9:57 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 8 2023, 9:57 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne added a subscriber: ldionne.Mar 8 2023, 3:33 PM
ldionne added inline comments.
runtimes/CMakeLists.txt
147

I think it would be really nice to instead avoid passing -nostdinc++ to the linker when we don't mean it. That would require a bit of reworking of how we detect compiler options, but that might be a good idea nonetheless. Thoughts?

Mordante added inline comments.Mar 9 2023, 8:31 AM
runtimes/CMakeLists.txt
147

I initially looked at that solution, but based on the documentation there's no real option for that
https://cmake.org/cmake/help/latest/module/CheckCSourceCompiles.html

Do you have a suggestion how to achieve that solution?

phosek added a subscriber: phosek.Mar 9 2023, 10:15 AM

I have D142957 that's trying to address the same underlying issue and with that change I can build runtimes with CMake 3.26. It needs to be broken up and landed piecemeal which I started (so far I have D143052 and D144440) but haven't finished yet due to a lack of time. I can try to prioritize it.

Mordante abandoned this revision.Mar 10 2023, 9:41 AM

I have D142957 that's trying to address the same underlying issue and with that change I can build runtimes with CMake 3.26. It needs to be broken up and landed piecemeal which I started (so far I have D143052 and D144440) but haven't finished yet due to a lack of time. I can try to prioritize it.

It would be good if it can be prioritized. I like to use CMake 3.26 to work on C++ modules in libc++. For now I keep merge this patch with D144994. (Note CMake 3.26 has not been released yet and I want at least wait until it's released.)