-
Notifications
You must be signed in to change notification settings - Fork 37.7k
build: Make config warnings fatal if -DWCONFIGURE_ERROR=ON #31665
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
build: Make config warnings fatal if -DWCONFIGURE_ERROR=ON #31665
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31665. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Related to #31476. |
This should never be the case, otherwise the minimum required version isn't actually the minimum required version. |
281b7fd
to
8b3999a
Compare
🤦 I did not realize that's what #31593 was fixing.
Done, by logging
Sorry, I misspoke, I meant syntax features and behavior that are only available in the minimum version or greater. Anyways, I think it's fine to leave it as a warning, since it doesn't impact the executables. |
8b3999a
to
2b2c9e6
Compare
09cd0c5
to
587f53e
Compare
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.
I don't like the idea of overloading the WERROR
build option with additional functionality, as this is not what users would expect.
However, if this PR proceeds in its current direction, the new functionality must be clearly documented in the WERROR
build option's help string.
Although one thing that could be improved is making the error more clear, as in the current output, it's hidden far back in the scrollback.
There is no need to continue after encountering an error:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,11 +78,13 @@ include(CMakeDependentOption)
# When adding a new option, end the <help_text> with a full stop for consistency.
set(configure_warnings)
option(WERROR "Treat compiler warnings as errors." OFF)
-if(WERROR)
- set(configure_warning_message_type FATAL_ERROR)
-else()
- set(configure_warning_message_type WARNING)
-endif()
+macro(user_message message)
+ if(WERROR)
+ message(FATAL_ERROR ${message})
+ else()
+ list(APPEND configure_warnings ${message})
+ endif()
+endmacro()
option(BUILD_DAEMON "Build bitcoind executable." ON)
option(BUILD_GUI "Build bitcoin-qt executable." OFF)
@@ -116,7 +118,7 @@ if(WITH_BDB)
"BDB (legacy) wallets opened by this build will not be portable!"
)
if(WARN_INCOMPATIBLE_BDB)
- list(APPEND configure_warnings
+ user_message(
"Incompatible Berkeley DB found. If this is intended, pass \"-DWARN_INCOMPATIBLE_BDB=OFF\".\nPassing \"-DWITH_BDB=OFF\" will suppress this warning."
)
endif()
@@ -552,7 +554,7 @@ find_package(Python3 3.10 COMPONENTS Interpreter)
if(Python3_EXECUTABLE)
set(PYTHON_COMMAND ${Python3_EXECUTABLE})
else()
- list(APPEND configure_warnings
+ user_message(
"Minimum required Python not found. Utils and rpcauth tests are disabled."
)
endif()
@@ -655,10 +657,7 @@ message("\n")
if(configure_warnings)
message(" ******\n")
foreach(warning IN LISTS configure_warnings)
- if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.26)
- message(CONFIGURE_LOG "${warning}") # Log to the cmake-configure-log file before a potentially fatal message.
- endif()
- message(${configure_warning_message_type} "${warning}")
+ message(WARNING "${warning}")
endforeach()
message(" ******\n")
endif()
Can you elaborate on why this would be unexpected? This is an option to turn warnings into errors, and it'd just be turning more warnings into errors. I'm assuming any user who'd want to use this locally is exactly the kind of user who'd rather see more warnings than less? |
Other projects use the same or similar build option only to turn compiler's warnings into errors. |
Sure, but should that dictate what we do? Having an option to turn warnings into errors, that turns slightly more warnings into errors compared to other projects, and is mostly used in our CI where we want to surface all warnings, seems reasonable. Given that CMake lacks any native functionality to acheive the same thing, using |
The minimum should probably not be bumped at all, until we are ready to start using features requiring it... and that usage is why we're disabling tests if the minimum isn't met, right? |
As pointed in #31724 (comment), this change will break builds on systems where a toolchain does not support PIE. |
I don't think this is entirely right. appstream ships with 3.11 and 3.12 on centos. (You can install them just like you can install g++-14 on centos 9).
I don't think this is "worse". If the minimum version is 3.10, then any feature in that version should be allowed to be used. For context, the bump was done for two reasons:
|
587f53e
to
1a90741
Compare
1a90741
to
fe58cfc
Compare
In light of the fact that that reusing
What I was trying to get at is: Why maintain a list of tests that get disabled if the python version is below the minimum, if this list has not been maintained as newer python features have been used elsewhere. (e.g. match statement in It seems that either trying to run the functional tests with I've edited the PR description to better phrase this question since I think the way that I worded it was confusing or didn't make sense. maybe this discussion is more relevant in #31669 |
Rebased to address reviewer feedback that the guix builds should have this option enabled, and that |
3e56d5b
to
df60131
Compare
Rebased to fix merge conflict, this needs conceptual review, it seems to me the main question is: Should it be possible to make config warnings fatal? Or is it the case that any time you want to make a warning fatal, you have a warning that should probably always be an error? It's possible also that having a python version below the minimum should always be an error, and that some other warnings should be configurably errorized.. . I think it's worth separating out the python version warning issue from the general issue of #31476. |
df60131
to
f4a9073
Compare
Rebased to address merge conflict after legacy wallet removal. |
f4a9073
to
4b4e5d4
Compare
Also log `configure_warnings` to cmake-configure-log before a potentially fatal message to make CI output more readable.
4b4e5d4
to
b2c1f5b
Compare
@davidgumberg FYI I've implemented something using |
OK, closing this in favor of #32865. |
Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use] |
Summarizing #31476, the CentOS CI task has been configuring a build with python
3.9
(the latest version in the Stream 9BaseOS
repository) which is below the minimum version of3.10
which resulted in a warning being appended to theconfigure_warnings
cmake variable.bitcoin/CMakeLists.txt
Lines 546 to 553 in 712cab3
This warning has been emitted by every CI run on CentOS1 since the minimum version was bumped (#30527) and until the centos task was bumped to stream 10 in #31593 But this has not resulted in CI failure, even though
utils
andrpcauth
tests have been skipped.This branch adds a cmake build option
WCONFIGURE_ERROR
that if on makes the presence ofconfigure_warnings
aFATAL_ERROR
it also makes an incompatible BDB version a configure_warning if-DWARN_INCOMPATIBLE_BDB=ON
.Footnotes
e.g. https://cirrus-ci.com/task/5526283183980544?logs=ci#L895, https://cirrus-ci.com/task/6597682371756032?logs=ci#L894 ↩