-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
[libc++] Define all CMake configuration features in the same location #115361
Conversation
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesThis moves the configuration of the CMake features to turn off RTTI, exceptions and friends to the beginning of the CMake file, where we configure other optional parts of the library. This fixes an important bug where we would disable the benchmarks because these options were not defined yet, leading to the build thinking they were defined to OFF. Full diff: https://github.com/llvm/llvm-project/pull/115361.diff 1 Files Affected:
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index d699135774ee0b..abe12c2805a7cf 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -47,6 +47,10 @@ include(HandleCompilerRT)
# Basic options ---------------------------------------------------------------
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
+option(LIBCXX_ENABLE_EXCEPTIONS "Enable exceptions in the built library." ON)
+option(LIBCXX_ENABLE_RTTI
+ "Use runtime type information.
+ This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
option(LIBCXX_ENABLE_FILESYSTEM
"Whether to include support for parts of the library that rely on a filesystem being
available on the platform. This includes things like most parts of <filesystem> and
@@ -97,6 +101,10 @@ option(LIBCXX_ENABLE_WIDE_CHARACTERS
support the C functionality for wide characters. When wide characters are
not supported, several parts of the library will be disabled, notably the
wide character specializations of std::basic_string." ON)
+option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
+option(LIBCXX_ENABLE_MONOTONIC_CLOCK
+ "Build libc++ with support for a monotonic clock.
+ This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
# To use time zone support in libc++ the platform needs to have the IANA
# database installed. Libc++ will fail to build if this is enabled on a
@@ -284,14 +292,6 @@ if (LIBCXX_BUILD_32_BITS)
endif()
# Feature options -------------------------------------------------------------
-option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
-option(LIBCXX_ENABLE_RTTI
- "Use runtime type information.
- This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
-option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
-option(LIBCXX_ENABLE_MONOTONIC_CLOCK
- "Build libc++ with support for a monotonic clock.
- This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF)
|
This moves the configuration of the CMake features to turn off RTTI, exceptions and friends to the beginning of the CMake file, where we configure other optional parts of the library. This fixes an important bug where we would disable the benchmarks because these options were not defined yet, leading to the build thinking they were defined to OFF.
1e15e50
to
0f10a25
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/193/builds/3136 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/3715 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/833 Here is the relevant piece of the build log for the reference
|
@vitalybuka Do you know who owns the |
@vvereschaka Sorry for breaking your windows bot, that failure seems legitimate. It looks like we're now trying to build the benchmarks (on Windows) but we weren't previously. I suspect this is because building GoogleBenchmark won't work in a windows-cross-linux configuration, I imagine you have flags that make it unhappy. IMO the way to go here might be (sadly) to use |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/3560 Here is the relevant piece of the build log for the reference
|
Hey @ldionne - possibly related to #115361 (comment), we're also seeing this error propagate on our clang-linux-arm64/clang-linux-x64 down stream builders as well[0]. It sounds like this change possibly triggered something that was broken with how
|
@ldionne thank you for letting me know. I'll test the build configuration with UPDATE: unfortunately passing |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/85/builds/2783 Here is the relevant piece of the build log for the reference
|
I am seeing this in your error message, which seems to be the problem:
I guess just using
Can you try doing a clean build? We definitely don't try to configure GoogleBenchmarks if llvm-project/libcxx/test/CMakeLists.txt Line 65 in 0fd6f68
Can you share more context around the failure you're still seeing? |
This addresses the issue uncovered by llvm#115361. Previously, we weren't building benchmarks in many cases due to the following block: https://github.com/llvm/llvm-project/blob/e58949632e91477af58d983f3b66369e6a2c8233/libcxx/CMakeLists.txt#L162-L172 We need to passthrough the necessary variables into the benchmarks subbuild and use correct syntax.
|
…llvm#115361) This moves the configuration of the CMake features to turn off RTTI, exceptions and friends to the beginning of the CMake file, where we configure other optional parts of the library. This fixes an important bug where we would disable the benchmarks because these options were not defined yet, leading to the build thinking they were defined to OFF.
Good point, they include more heavy steps which likely fail for reasons other than libc++. Solution is to extract libc++ into dedicated builder. llvm/llvm-zorg#310 for tracking. |
However this one looks very relevant @ldionne |
I was quick with judgement. It will not help. They are just slow, but far from slowest bots on LLVM. Slow bots mean large blame list, more unrelated patches blamed with broken patch. I don't think that they are any how special. Bots a very useful catching sanitizer related miscompilations early. |
I think this is because we're now building and running benchmarks that we weren't building before due to: llvm-project/libcxx/CMakeLists.txt Lines 162 to 172 in e589496
Those benchmarks run too slowly and timeout when built with instrumentation. |
Thanks, there is obviously no point to do so with sanitizers. |
…6644) This addresses the issue uncovered by #115361. Previously, we weren't building benchmarks in many cases due to the following block: https://github.com/llvm/llvm-project/blob/e58949632e91477af58d983f3b66369e6a2c8233/libcxx/CMakeLists.txt#L162-L172 We need to passthrough the necessary variables into the benchmarks subbuild and use correct syntax.
…m#116644) This addresses the issue uncovered by llvm#115361. Previously, we weren't building benchmarks in many cases due to the following block: https://github.com/llvm/llvm-project/blob/e58949632e91477af58d983f3b66369e6a2c8233/libcxx/CMakeLists.txt#L162-L172 We need to passthrough the necessary variables into the benchmarks subbuild and use correct syntax.
@ldionne ,
sorry, it was my bad with some mistype during the quick check. |
@petrhosek @vitalybuka FWIW I suspect that you folks are running the tests using |
Can't say for @petrhosek issues But bootstrap bots run |
We're using |
This moves the configuration of the CMake features to turn off RTTI, exceptions and friends to the beginning of the CMake file, where we configure other optional parts of the library.
This fixes an important bug where we would disable the benchmarks because these options were not defined yet, leading to the build thinking they were defined to OFF.