This leaves $(BITCOIN_INCLUDES)
as internal dependencies, and gives finer control over Boost includes.
Fixes #25947.
Concept ACK.
Hah, I was working on this at the same time (on top of master, though). To compare, here’s what I came up with: https://github.com/theuni/bitcoin/commit/400eede3e56b15db86a83d7785a57f179f6cba85
Rather than adding it where it looked like it would be needed, I added a depends commit to move boost out of the common prefix path, that way we’ll actually detect missing headers: https://github.com/theuni/bitcoin/commit/e131d8f1e33baa9a9499d2e1a4a99b171566c5a5 . Then I rebuilt everything and added BOOST_CPPFLAGS
one-by-one as needed to fix compilation.
Looks like the only difference between ours (other than test_util) is missing BOOST_CPPFLAGS
for bitcoin_chainstate
ACK after adding that (and after c-i is happy).
here’s what I came up with: theuni@400eede
With flag reordering as follows:
0diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
1index 4fe79652e..602a11825 100644
2--- a/src/Makefile.qt.include
3+++ b/src/Makefile.qt.include
4@@ -295,7 +295,7 @@ BITCOIN_QT_RC = qt/res/bitcoin-qt-res.rc
5 BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER
6
7 qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
8- $(BOOST_CPPFLAGS) $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS)
9+ $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) $(BOOST_CPPFLAGS)
10 qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
11 qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
12
13diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include
14index afcd4106b..89c659d4b 100644
15--- a/src/Makefile.qttest.include
16+++ b/src/Makefile.qttest.include
17@@ -27,7 +27,7 @@ TEST_QT_H = \
18 qt/test/wallettests.h
19
20 qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
21- $(BOOST_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES)
22+ $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(BOOST_CPPFLAGS)
23
24 qt_test_test_bitcoin_qt_SOURCES = \
25 init/bitcoin-qt.cpp \
your commit fixes #25947 as well.
Looks like the only difference between ours (other than test_util) is missing BOOST_CPPFLAGS for bitcoin_chainstate
The bin I didn’t test compiling 😅. Rebased on master and fixed this up.
This diff:
0--- a/src/Makefile.am
1+++ b/src/Makefile.am
2@@ -753,7 +753,7 @@ bitcoin_node_LDADD = $(LIBBITCOIN_NODE) $(bitcoin_bin_ldadd) $(LIBBITCOIN_IPC) $
3
4 # bitcoin-cli binary #
5 bitcoin_cli_SOURCES = bitcoin-cli.cpp
6-bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
7+bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS)
8 bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
9 bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
10
fixes macOS native build.
fixes macOS native build.
I don’t think that’s the right solution, and would actually just hide the underlying problem. Re-adding $(BOOST_CPPFLAGS)
where it isn’t needed, also defeats the point of this change.
Given that the CI runs with --enable-suppress-external-warnings
, and the failure is due to warnings coming from libevent, there is some other problem here; -Wdocumentation
warnings for an external dependency shouldn’t be appearing at all.
Looking at the log, we’ve got -isystem /usr/local/Cellar/libevent/2.1.12/include
, but then:
0In file included from bitcoin-cli.cpp:40:
1/usr/local/include/event2/buffer.h:210:11: error: parameter 'buffer' not found in the function declaration [-Werror,-Wdocumentation]
2 * [@param](/bitcoin-bitcoin/contributor/param/) buffer the evbuffer that the callback is watching.
3 ^~~~~~
so I assume the reason these are currently being suppressed is actually due to the Boost cppflags always being present, which adds -isystem /usr/local/include -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE
to the compile, and suppresses all warnings coming from /usr/local/include
.
From ./ci/test/00_setup_env_native_asan.sh :
export PACKAGES=“systemtap-sdt-dev bpfcc-tools clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev”
From .cirrus.yml:
brew_install_script: - brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
Seems we’re pulling libevent (and a few others) from 2 places for MacOS. Why?
It is a bit messy, but the brew macos build doesn’t use the Ubuntu apt, so there should only be one place where this is installed: https://github.com/bitcoin/bitcoin/blob/5558d2f5496d8fe1c16f9edd1ef395fcd842e6fb/.cirrus.yml#L332
You can also check the logs produced at runtime to double check.
I played around a little bit with this locally and was able to reproduce with a minimal test-case.
I believe this commit (untested) should fix the root issue here: https://github.com/theuni/bitcoin/commit/7929a2a426624740fcb007ab16af3b5a11f35a68 (see the comment for a description of the issue). @hebasto do you have an easy way of testing? If not, I can just open a PR with these two commits and see if c-I is happy.
Edit: updated to include a test.
here’s what I came up with: theuni@400eede
With flag reordering as follows:
0diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include 1index 4fe79652e..602a11825 100644 2--- a/src/Makefile.qt.include 3+++ b/src/Makefile.qt.include 4@@ -295,7 +295,7 @@ BITCOIN_QT_RC = qt/res/bitcoin-qt-res.rc 5 BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER 6 7 qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ 8- $(BOOST_CPPFLAGS) $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) 9+ $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS) $(BOOST_CPPFLAGS) 10 qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) 11 qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS) 12 13diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include 14index afcd4106b..89c659d4b 100644 15--- a/src/Makefile.qttest.include 16+++ b/src/Makefile.qttest.include 17@@ -27,7 +27,7 @@ TEST_QT_H = \ 18 qt/test/wallettests.h 19 20 qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ 21- $(BOOST_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES) 22+ $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(BOOST_CPPFLAGS) 23 24 qt_test_test_bitcoin_qt_SOURCES = \ 25 init/bitcoin-qt.cpp \
your commit fixes #25947 as well.
I do think specifying explicitly probed include paths (bdb/sqlite/qt5/miniupnpc/natpmp) before the others for brew whenever we can makes sense as a policy. And in this case, I agree that it would fix the problem. That said, I’m not sure we can always do this (include order may matter for other reasons), and homebrew isn’t exactly our top priority.
So, since I don’t see any reason not to in this case… ACK reversing the order as you suggested.
Rebased on master / #26070.
That said, I’m not sure we can always do this (include order may matter for other reasons), and homebrew isn’t exactly our top priority. So, since I don’t see any reason not to in this case… ACK reversing the order as you suggested.
I’ve ordered the flags in this way, however I agree that doing this is not ideal, and somewhat fragile.
This leaves $(BITCOIN_INCLUDES) as internal dependencies, and gives
finer control over Boost includes.
ACK 12de8f6262e9e74eb3c1a1c46070f7bc6a4cdac6
It’s nice that we’re now forced to make all external dependencies explicit. I suspect this will eventually lead to a few more boost removals.
fanquake
hebasto
theuni
Sjors
MarcoFalke
kouloumos
jarolrod
Zero-1729
Labels
Build system
Milestone
24.0