-
Notifications
You must be signed in to change notification settings - Fork 6
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
cmake: Switch from tri-state options to boolean. Stage TWO #162
Conversation
cc @0xB10C |
d22142e
to
4d8e8f0
Compare
One thought I had recently: It might make sense for us to vendor the relevant parts of systemtap's sys/std.h. If we can get this into master before merging cmake, we can drop this check? Nonetheless, happy to take closer look here. |
4d8e8f0
to
43c9bc3
Compare
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
|
||
This module defines the following variables: |
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.
Why? If it's not exported / used anywhere outside of this.
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.
- It is expected from any Find module.
From CMake docs:
The primary task of a find module is to determine whether a package is available, set the
<PackageName>_FOUND
variable to reflect this...
- It was used in the first commit. However, the second commit removed that usage.
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.
However, the second commit removed that usage.
So then it can be removed? Or are we adding dead/unused code to our build system because of what the CMake docs say? Or are we doing things incorrectly, if we aren't using the variables we are adding, according to the docs?
depends/Makefile
Outdated
@@ -293,7 +293,7 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina | |||
-e 's|@no_sqlite@|$(NO_SQLITE)|' \ | |||
-e 's|@no_upnp@|$(NO_UPNP)|' \ | |||
-e 's|@no_natpmp@|$(NO_NATPMP)|' \ | |||
-e 's|@no_usdt@|$(NO_USDT)|' \ | |||
-e 's|@no_usdt@|$(NO_USDT)|' -e 's|@usdt_packages@|$(usdt_packages_)|' \ |
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.
Why do we need to do this
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.
Considering
bitcoin/depends/packages/packages.mk
Line 28 in 19722e3
usdt_linux_packages=systemtap |
usdt_packages
variable is non-empty for Linux only.
For other systems, in the absence of NO_USDT=1
, the depends build system has set(WITH_USDT ON)
in the toolchain file, which is wrong.
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.
If this is only relevant for Linux, then we should really fix the depends output based on package availability, rather than working around issues that shouldn't exist, but I'm also not sure if that's true when we get macOS support, in which case, I assume it's just a bug for Windows?
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'm also not sure if that's true when we get macOS support, in which case, I assume it's just a bug for Windows?
We can return back to this problem in the time when we actually get macOS support.
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.
MacOS (and FreeBSD) tracepoints don't use systemtap and don't require any other dependencies.
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 apologise but I feel completely lost. I still don't understand what the bug is.
Is it present in the master branch?
Is it introduced in this PR?
What options do trigger this bug when invoking make -C depends
?
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 just mean the fact that depends is handling anything USDT related at all, for non-linux systems. If this wasn't the case, we could have cleaner logic here. We can just track this as something to cleanup at some point, but the improvements to master would be relevant pre or post CMake (ideally before as that'll keep the build systems closer between branches).
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.
It looks to me like the current (master) behavior for a non-linux platform is:
- USDT is enabled by default
- the package doesn't get built by depends
- usdt is enabled by the config.site
- configure fails to find the headers so it's disabled in the end
On this branch that approach won't work, because it's opt-in only. Therefore @hebasto's solution is to only enable it if it's not disabled and if it's defined for the platform. I think that's a reasonable generic approach.
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.
Though I think we could simply with:
's|@usdt_packages@|$(usdt_packages_$(NO_USDT))|'
Then just test for:
if("@usdt_packages@")
set(WITH_USDT ON CACHE BOOL "")
?
And to @fanquake's point, I think that would apply to master as well:
diff --git a/depends/config.site.in b/depends/config.site.in
index 7c699087bbc..b6b38bd3148 100644
--- a/depends/config.site.in
+++ b/depends/config.site.in
@@ -70,7 +70,7 @@ if test -z "$enable_zmq" && test -n "@no_zmq@"; then
enable_zmq=no
fi
-if test -z "$enable_usdt" && test -n "@no_usdt@"; then
+if test -z "$enable_usdt" && test -z "@usdt_packages@"; then
enable_usdt=no
fi
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.
Thanks! Reworked.
Why? |
We don't use >99% of systemtap, and only need There are two ways of doing this:
If you have any concerns in terms of e.g. impact on maintainability, please let me know. I'm currently not aware of large arguments against it. I briefly mentioned this to @laanwj and had the impression that he agreed with the general direction - I could be wrong. A wip branch can be found here: https://github.com/0xB10C/bitcoin/commits/2024-04-vendor-systemtap-sys-sdt-h/ |
We don't drop it as a dependency, just internalize it, and have to make sure it actually stays updated / we pull fixes/changes when necessary. (in this case it may be simple enough).
This will always be required. |
43c9bc3
to
ffef539
Compare
Rebased to resolve conflicts. |
Yes, i agree on that. It's important to realize how simple this header is, for just defining the probes. It's just a bunch of macros (that add a symbol and ELF metadata), and reducing it to just what we use allows making it even smaller. No actual function definitions, code, or data structures are defined. There's very little to bugfix or maintain, or that could even change over time. |
ffef539
to
8214ef1
Compare
So vendoring USDT would eliminate the search for the dependency, then it's simply a question for the builder of on or off? That sounds quite nice. |
That is for the master branch, right? This PR scope is different :) |
Rework in a target-focused way.
8214ef1
to
ab5992a
Compare
Rebased. |
ab5992a
to
598eda8
Compare
Addressed @theuni's #162 (comment) with taking into account the CMake's
|
5de23c7 fixup! cmake: Add preset for MSVC build (Hennadii Stepanov) 09b1d5b fixup! ci: Test CMake edge cases (Hennadii Stepanov) 820a538 cmake [KILL 3-STATE]: Switch `WITH_QRENCODE` to boolean w/ default ON (Hennadii Stepanov) 017aeda cmake [FIXUP]: Move `find_program(brew)` out from introspection file (Hennadii Stepanov) Pull request description: This PR is a continuation of #161, #162 and #164 and tackles with the `WITH_QRENCODE` options. It becomes enabled when building GUI with the default value `ON`. Top commit has no ACKs. Tree-SHA512: 9cd923ef89e0a485330205db4389e42c001cbd6683a14b1e0c665d8e790e8bb2cae7b8b1929818443aea8eb5cbf6cafa79f4e44f41a893f54a5cdc09abc49dc1
Looks good to me. Seems to work as expected. When building for Linux it ends up on by default, but is still override-able by setting If we decide we'd rather not have it on by default for depends build, we can make it opt-in there rather than opt-out. |
@@ -5,10 +5,6 @@ | |||
#ifndef BITCOIN_UTIL_TRACE_H | |||
#define BITCOIN_UTIL_TRACE_H | |||
|
|||
#if defined(HAVE_CONFIG_H) |
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 also really like this change, even if it's just incidental. It's very unlikely that out-of-tree builds would be interested in USDT (though they could of course still access it by setting the define).
One less low-level header including this file.
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.
Looks good to me. Seems to work as expected. When building for Linux it ends up on by default, but is still override-able by setting -DWITH_USDT=False.
Hm, that differs from my result on 598eda8 (cmake [KILL 3-STATE]: Switch WITH_USDT to boolean w/ default OFF
). It ends up being off by default for me. I can enable it with -DWITH_USDT=ON
.
edit: maybe that's a issue on the NixOS side?
"if sys/sdt.h is found." | ||
AUTO | ||
) | ||
option(WITH_USDT "Enable tracepoints for Userspace, Statically Defined Tracing." OFF) |
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.
Do we want to have this OFF by default? Since v23.0 (specifically bitcoin#23724), all release builds have had tracepoints compiled in by default as the systemtap headers are available.
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.
Do we want to have this OFF by default?
Every optional dependency become opt-in.
Since v23.0 (specifically bitcoin#23724), all release builds have had tracepoints compiled in by default as the systemtap headers are available.
Release functionality must be preserved. There should be WITH_USDT=ON
.
I've just checked the staging branch on Ubuntu 23.10. It works:
It seems so. Let's continue the further discussion in #126. |
What exactly did you run? For me
Plain
My confusion is more about @theuni's "When building for Linux it ends up on by default" - which is not the case for me and I wouldn't expect it from the code. (but I think we might want it to be ON by default #162 (comment)?) |
|
It is about building with depends, I guess. UPD. As it has been said before all optional package (USDT, ZMQ, Qt etc) are to be opt-in. |
2b4ad50 cmake [KILL 3-STATE]: Switch `WITH_{SQLITE,BDB}` to boolean (Hennadii Stepanov) Pull request description: This PR is a continuation of #161 and #162 and tackles with the `WITH_SQLITE` and `WITH_BDB` options. For the latter the default value `OFF` is suggested. The #83 (comment): > Shouldn't `WITH_SQLITE=ON` imply `ENABLE_WALLET`? What (extra) does `ENABLE_WALLET` do here? I'm not sure we'll actually want to keep it as an option. has been addressed. ACKs for top commit: TheCharlatan: ACK 2b4ad50 Tree-SHA512: 13d5bd16709ab557ee736696fe1d5d3fe64bae8cb77c000401c26b8be2deab0473474f7fa9bb958884ba3ab9c4d0b66e44766ca5c1c86d0fab3957642ec996b9
Same as #161, but USDT-specific with refactoring of the USDT search logic into its own "FindUSDT" module.
The first commit is a pure refactoring.