Cap’n Proto 0.9.x and 0.10.x are incompatible with Clang 16+ when using C++20 due to P2468R2 implementation. This was fixed in Cap’n Proto 1.0+.
Generate a helpful error when these combinations are detected.
See: #199 for more context
Cap’n Proto 0.9.x and 0.10.x are incompatible with Clang 16+ when using C++20 due to P2468R2 implementation. This was fixed in Cap’n Proto 1.0+.
Generate a helpful error when these combinations are detected.
See: #199 for more context
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See 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.
49+ "Cap'n Proto ${CapnProto_VERSION} is incompatible with Clang ${CMAKE_CXX_COMPILER_VERSION} when using C++20.\n"
50+ "To resolve this issue, choose one of the following:\n"
51+ " 1. Upgrade to Cap'n Proto version 1.0 or newer (recommended)\n"
52+ " 2. Downgrade to Cap'n Proto version 0.8 or earlier\n"
53+ " 3. Use GCC instead of Clang\n"
54+ " 4. For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support\n"
Code review ACK ee5e284cca563eb43ec3587d114586865db70b43. This seems like it should be a helpful change.
The approach suggested https://github.com/bitcoin/bitcoin/pull/33290#issuecomment-3249470528 could potentially be used to avoid needing to mention the bitcoin core option here, and could be a followup
35@@ -36,6 +36,25 @@ if(CapnProto_VERSION STREQUAL "0.7.0"
36 ")
Do you mean this part?
0/usr/include/capnp/blob.h:176:74: error: invalid operands to binary expression ('const char *' and 'kj::StringPtr')
Sorry for being unclear, I meant to append:
0 "To resolve this issue, choose one of the following:\n"
1 " 1. Upgrade your version of Cap'n Proto to a patched minor version (0.7.1, 0.8.1, 0.9.2, 0.10.3, or any later major version)\n"
2 " 2. For Bitcoin Core compilation, build with -DENABLE_IPC=OFF to disable multiprocess support\n"
47+ (CMAKE_CXX_STANDARD EQUAL 20))
48+ message(FATAL_ERROR
49+ "Cap'n Proto ${CapnProto_VERSION} is incompatible with Clang ${CMAKE_CXX_COMPILER_VERSION} when using C++20.\n"
50+ "To resolve this issue, choose one of the following:\n"
51+ " 1. Upgrade to Cap'n Proto version 1.0 or newer (recommended)\n"
52+ " 2. Downgrade to Cap'n Proto version 0.8 or earlier\n"
Downgrade to Cap’n Proto version 0.8 or earlier
I think this should say 0.8.1, so it’s clear we aren’t suggesting to downgrade to 0.8.0, which wont work, given the check for CVEs above. Although I think ideally, we wouldn’t suggest downgrading at all.
OK, I am a bit of a cmake language noob, so apologies in advance if I’ve butchered this, but I’ve tried to share the common error message in 197aef2e2b4a4dd35ffa2bf5783ba6fe636ea48d to along with @fanquake’s suggestion of not recommending downgrading (which seems sensible).
To avoid also the situation where we have two seperate checks which a user could fail sequentially (but only after installing a second version of capnproto!), I have tried to merge them into a single check, with logic for each check type.
This way a user should only ever fail on this version check once, and should be shown appropriate options.
@willcl-ark I started to look at 197aef2e2b4a4dd35ffa2bf5783ba6fe636ea48d which seems like a nice approach.
Any interested in extending it to replace https://github.com/bitcoin/bitcoin/pull/33290? It would be great to show a better error message when find_package(CapnProto) fails here and it looks like the new code you’ve written could be easily extended to do it.
I think you would just need to replace
0find_package(CapnProto 0.7 REQUIRED NO_MODULE)
with
0find_package(CapnProto 0.7 QUIET NO_MODULE)
1if (NOT CapnProto_FOUND)
2 # ... custom handling here ...
3endif()
Cap'n Proto 0.9.x and 0.10.x are incompatible with Clang 16+ when using C++20 due to P2468R2 implementation.
This was fixed in Cap'n Proto 1.0+.
Generate a helpful error when these combinations are detected.
See: https://github.com/bitcoin-core/libmultiprocess/issues/199
Add a helpful error when we fail to find the package at all.
@ryanofsky I added the suggested check here.
I did look at having a single giant “check package, then version compatibility” section (i.e. extending what is there currently), but the code is much cleaner using a specific
0find_package(CapnProto 0.7 QUIET NO_MODULE)
1 if(NOT CapnProto_FOUND)
2 message(FATAL_ERROR
…even if that means we repeat a string or two.
I tested 657d80622f81ba3258780b2157a2771195ee4988 by updating the subtree in Bitcoin Core, and uninstalling capnp:
0CMake Error at src/ipc/libmultiprocess/CMakeLists.txt:18 (message):
1 Cap'n Proto is required but was not found.
2
3 To resolve, choose one of the following:
4
5 - Install Cap'n Proto (version 1.0+ recommended)
6 - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support
That’s quite nice.
Testing 657d80622f81ba3258780b2157a2771195ee4988 with different settings in olddeps.bash and it seems to work well.
0$ rm -rvf build-olddeps; CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
1[...]
2CMake Error at CMakeLists.txt:76 (message):
3 The version of Cap'n Proto detected: 0.9.0 has known compatibility issues:
4
5 - CVE-2022-46149 security vulnerability (details:
6 https://github.com/advisories/GHSA-qqff-4vw4-f6hx)
7
8 To resolve, choose one of the following:
9
10 - Upgrade to Cap'n Proto version 1.0 or newer (recommended)
11 - Upgrade to a patched minor version (0.7.1, 0.8.1, 0.9.2, 0.10.3, or later)
12 - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support
0$ rm -rf build-olddeps; CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
1[...]
2CMake Error at CMakeLists.txt:76 (message):
3 The version of Cap'n Proto detected: 0.9.0 has known compatibility issues:
4
5 - CVE-2022-46149 security vulnerability (details:
6 https://github.com/advisories/GHSA-qqff-4vw4-f6hx)
7
8 - Incompatible with Clang 20.1.5 when using C++20
9
10 To resolve, choose one of the following:
11
12 - Upgrade to Cap'n Proto version 1.0 or newer (recommended)
13 - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support
0$ rm -rf build-olddeps; CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
1[...]
2CMake Error at CMakeLists.txt:76 (message):
3 The version of Cap'n Proto detected: 0.9.2 has known compatibility issues:
4
5 - Incompatible with Clang 20.1.5 when using C++20
6
7 To resolve, choose one of the following:
8
9 - Upgrade to Cap'n Proto version 1.0 or newer (recommended)
10 - Use GCC instead of Clang
11 - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support
0$ rm -rf build-olddeps; CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
1[...]
2CMake Error at CMakeLists.txt:18 (message):
3 Cap'n Proto is required but was not found.
4
5 To resolve, choose one of the following:
6
7 - Install Cap'n Proto (version 1.0+ recommended)
8 - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support
61+ string(APPEND RESOLUTION_OPTIONS " - Upgrade to a patched minor version (0.7.1, 0.8.1, 0.9.2, 0.10.3, or later)\n")
62+ elseif(CAPNPROTO_CLANG_INCOMPATIBLE AND NOT CAPNPROTO_CVE_AFFECTED)
63+ string(APPEND RESOLUTION_OPTIONS " - Use GCC instead of Clang\n")
64+ endif()
65+
66+ string(APPEND RESOLUTION_OPTIONS " - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support\n")
In commit “cmake: check for Cap’n Proto / Clang / C++20 incompatibility” (d314057775a552391b439f164fd23e8b7458cbeb)
This might be more readable with a comma after “compilation”. Also I think the “if you do not need IPC functionality” phrasing from https://github.com/bitcoin/bitcoin/pull/33290 might make the effects of this easier to understand than “to disable multiprocess support”. Maybe my suggestion would be to change this to something like “If building Bitcoin Core and you do not need IPC functionality, configure cmake with -DENABLE_IPC=OFF” here in and in the next commit.
This also seems fine for now though, and later we can drop if “If building Bitcoin Core” part by supporting a MP_SUBPROJECT_ERROR variable as suggested in the other issue.
20+ "Cap'n Proto is required but was not found.\n"
21+ "To resolve, choose one of the following:\n"
22+ " - Install Cap'n Proto (version 1.0+ recommended)\n"
23+ " - For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support\n"
24+ )
25+ endif()
Concept ACK.
As a follow-up, all code related to handling the CapnProto package could be encapsulated in a cmake/FindCapnProto.cmake module.