build: suggest -DENABLE_IPC=OFF when missing capnp #33290

pull Sjors wants to merge 1 commits into bitcoin:master from Sjors:2025/08/missing_capnp changing 1 files +10 −0
  1. Sjors commented at 7:41 am on September 3, 2025: member

    Since #31802, when existing users upgrade to a recent version of master, or the upcoming v30 release, they’ll be treated by an error that CapnProto is missing. Unless they read the release notes :-)

    This error is generated by src/ipc/libmultiprocess/CMakeLists.txt which is a git subtree and so it doesn’t have context of our project, and doesn’t know about the -DENABLE_IPC option.

    This pull request adds a simple pre-check in own CMake file to see if Cap’n Proto is missing. For ease of maintenance it doesn’t check the version.

    The new warning is shown in yellow, the (unchanged) error in red:

  2. DrahtBot added the label Build system on Sep 3, 2025
  3. DrahtBot commented at 7:41 am on September 3, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33290.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK janb84
    Concept ACK ismaelsadeeq, l0rinc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. Sjors commented at 7:52 am on September 3, 2025: member

    Very strange CI errors:

    003:45:32.525] -- Configuring incomplete, errors occurred!
    1[03:45:32.543] ++ cmake -P /ci_container_base/ci/test/GetCMakeLogFiles.cmake
    2[03:45:32.586] + cat CMakeFiles/CMakeConfigureLog.yaml
    3[03:45:32.587] cat: CMakeFiles/CMakeConfigureLog.yaml: No such file or directory
    4[03:45:32.621] Command '['./ci/test/02_run_container.sh']' returned non-zero exit status 1.
    
  5. DrahtBot added the label CI failed on Sep 3, 2025
  6. hebasto commented at 10:11 am on September 3, 2025: member

    Very strange CI errors:

    003:45:32.525] -- Configuring incomplete, errors occurred!
    1[03:45:32.543] ++ cmake -P /ci_container_base/ci/test/GetCMakeLogFiles.cmake
    2[03:45:32.586] + cat CMakeFiles/CMakeConfigureLog.yaml
    3[03:45:32.587] cat: CMakeFiles/CMakeConfigureLog.yaml: No such file or directory
    4[03:45:32.621] Command '['./ci/test/02_run_container.sh']' returned non-zero exit status 1.
    

    It seems a behaviour change overlooked in #32880.

  7. hebasto commented at 10:23 am on September 3, 2025: member

    Very strange CI errors:

    003:45:32.525] -- Configuring incomplete, errors occurred!
    1[03:45:32.543] ++ cmake -P /ci_container_base/ci/test/GetCMakeLogFiles.cmake
    2[03:45:32.586] + cat CMakeFiles/CMakeConfigureLog.yaml
    3[03:45:32.587] cat: CMakeFiles/CMakeConfigureLog.yaml: No such file or directory
    4[03:45:32.621] Command '['./ci/test/02_run_container.sh']' returned non-zero exit status 1.
    

    Suggesting this patch for a quick fix:

    0--- a/ci/test/03_test_script.sh
    1+++ b/ci/test/03_test_script.sh
    2@@ -123,6 +123,7 @@ if [[ "${RUN_TIDY}" == "true" ]]; then
    3 fi
    4 
    5 bash -c "cmake -S $BASE_ROOT_DIR -B ${BASE_BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || (
    6+  cd "${BASE_BUILD_DIR}"
    7   # shellcheck disable=SC2046
    8   cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake")
    9   false
    

    cc @maflcko

  8. Sjors force-pushed on Sep 3, 2025
  9. Sjors commented at 10:29 am on September 3, 2025: member
    Thanks @hebasto, I added a commit here to try that fix.
  10. maflcko commented at 10:53 am on September 3, 2025: member
    Mind submitting ed95f4f095fecb0a6e5601199959db21e811dd71 as a separate pull?
  11. Sjors commented at 11:28 am on September 3, 2025: member

    @maflcko I prefer if someone else does it, as I don’t really know what this part of CI is doing.

    Also, those builds still break.

  12. maflcko commented at 11:46 am on September 3, 2025: member

    Also, those builds still break.

    That is expected. https://github.com/bitcoin/bitcoin/commit/ed95f4f095fecb0a6e5601199959db21e811dd71 must not interfere with unrelated issues. The reason why your build fails is because you are adding the targets twice. (You can see this by reading the log)

  13. Sjors force-pushed on Sep 3, 2025
  14. Sjors commented at 12:25 pm on September 3, 2025: member
    @maflcko the log is very verbose, but in indeed useful, so I opened #33291.
  15. Sjors marked this as a draft on Sep 3, 2025
  16. maflcko commented at 12:40 pm on September 3, 2025: member

    @maflcko the log is very verbose, but in indeed useful, so I opened #33291.

    for reference, this specific warning was also printed without the verbose log: https://cirrus-ci.com/task/4516741763563520?logs=ci#L894 :

     0...
     1[03:43:58.798] CMake Error at /usr/lib/x86_64-linux-gnu/cmake/CapnProto/CapnProtoTargets.cmake:213 (add_executable):
     2[03:43:58.798]   add_executable cannot create imported target "CapnProto::capnpc_cpp"
     3[03:43:58.798]   because another target with the same name already exists.
     4[03:43:58.798] Call Stack (most recent call first):
     5[03:43:58.798]   /usr/lib/x86_64-linux-gnu/cmake/CapnProto/CapnProtoConfig.cmake:112 (include)
     6[03:43:58.798]   src/ipc/libmultiprocess/CMakeLists.txt:16 (find_package)
     7[03:43:58.798] 
     8[03:43:58.798] 
     9[03:43:58.798] CMake Error at /usr/lib/x86_64-linux-gnu/cmake/CapnProto/CapnProtoTargets.cmake:218 (add_executable):
    10[03:43:58.798]   add_executable cannot create imported target "CapnProto::capnpc_capnp"
    11[03:43:58.798]   because another target with the same name already exists.
    12[03:43:58.798] Call Stack (most recent call first):
    13[03:43:58.798]   /usr/lib/x86_64-linux-gnu/cmake/CapnProto/CapnProtoConfig.cmake:112 (include)
    14[03:43:58.798]   src/ipc/libmultiprocess/CMakeLists.txt:16 (find_package)
    15[03:43:58.798] 
    16[03:43:58.798] 
    17[03:43:58.801] -- Performing Test HAVE_PTHREAD_GETNAME_NP
    18[03:43:59.084] -- Performing Test HAVE_PTHREAD_GETNAME_NP - Success
    19[03:43:59.084] -- Performing Test HAVE_PTHREAD_THREADID_NP
    20[03:43:59.221] -- Performing Test HAVE_PTHREAD_THREADID_NP - Failed
    21[03:43:59.221] -- Performing Test HAVE_PTHREAD_GETTHREADID_NP
    22[03:43:59.344] -- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
    23[03:43:59.357] 
    24[03:43:59.357] Configuring secp256k1 subtree...
    25[03:43:59.483] -- The C compiler identification is Clang 21.1.0
    26[03:43:59.530] -- Detecting C compiler ABI info
    27[03:43:59.791] -- Detecting C compiler ABI info - done
    28[03:43:59.803] -- Check for working C compiler: /usr/bin/clang - skipped
    29[03:43:59.804] -- Detecting C compile features
    30[03:43:59.804] -- Detecting C compile features - done
    31...
    
  17. build: suggest -DENABLE_IPC=OFF when missing capnp f39a782ba8
  18. Sjors force-pushed on Sep 3, 2025
  19. Sjors commented at 12:49 pm on September 3, 2025: member

    Using find_program instead of find_package as suggested by an AI overlord, seems to do the trick.

    Another issue was that the depends build also threw this warning, which I added a check for.

  20. Sjors marked this as ready for review on Sep 3, 2025
  21. janb84 commented at 1:15 pm on September 3, 2025: contributor

    ACK f39a782ba8629bbca1587229f91ba2318d6b765c

    PR adds warning text to cmake configure step if CAPNP is not installed. The CAPNP dependency is new, and this warning helps people that do not read the Releasenotes how to solve the error.

    Although I do not recommend to upgrade without reading the Release notes / changelog, this warning can reduce the number of issues and guides (non-technical) users to avoid errors .

    • code review ✅
    • build with and without capnp to test warning. ✅

    without capnp:

    0CMake Warning at cmake/libmultiprocess.cmake:12 (message):
    1  Cap'n Proto (capnp) not found.  Compile with -DENABLE_IPC=OFF if you do not
    2  need IPC functionality.
    3Call Stack (most recent call first):
    4  src/CMakeLists.txt:24 (add_libmultiprocess)
    

    without capnp & -DENABLE_IPC=OFF:

    0  IPC ................................. OFF
    1  
    2-- Configuring done (4.8s)
    

    with capnp:

    0  IPC ................................. ON
    1  
    2-- Configuring done (5.2s)
    
  22. maflcko removed the label CI failed on Sep 3, 2025
  23. maflcko added this to the milestone 30.0 on Sep 3, 2025
  24. ryanofsky commented at 2:20 pm on September 3, 2025: contributor

    This is a nice idea and approach seems ok if it works in practice. I think a more general approach might to have the bitcoin build set a variable the libmultiprocess build can use to show better error messages like:

    0set(MP_SUBPROJECT_ERROR "Configure cmake with with -DENABLE_IPC=OFF if you do not need IPC functionality.")
    

    It could append this message if it can’t find the cap’n proto package, or doesn’t find a compatible version (for https://github.com/bitcoin-core/libmultiprocess/issues/199 and #33176).

  25. Sjors commented at 2:46 pm on September 3, 2025: member
    @ryanofsky I like your approach better since it can be used under more circumstances, such as not having the right version. But we’re close to branch-off so maybe this approach suffices for now.
  26. ismaelsadeeq commented at 3:30 pm on September 3, 2025: member
    Concept ACK
  27. in cmake/libmultiprocess.cmake:8 in f39a782ba8
    2@@ -3,6 +3,16 @@
    3 # file COPYING or https://opensource.org/license/mit/.
    4 
    5 function(add_libmultiprocess subdir)
    6+  # Provide a more helpful message without pulling in CapnProtoConfig.cmake,
    7+  # which is included again by libmultiprocess. Skip the check when using the
    8+  # depends toolchain.
    


    fanquake commented at 2:21 pm on September 4, 2025:
    NACK to adding any depends specific code. CMAKE_TOOLCHAIN_FILE also doesn’t necessarily mean a depends build; anyone can bring/use a toolchain file.

    ryanofsky commented at 3:37 pm on September 4, 2025:

    re: #33290 (review)

    NACK to adding any depends specific code. CMAKE_TOOLCHAIN_FILE also doesn’t necessarily mean a depends build; anyone can bring/use a toolchain file.

    Yeah I think it is clear this is not a good long term solution, but to be fair I don’t think there is much actual harm done here if CMAKE_TOOLCHAIN_FILE is set, since this would just fail to print a warning that is likely to be irrelevant.

    But I do think it could be nice to close this PR and extend @willcl-ark’s approach as described in https://github.com/bitcoin-core/libmultiprocess/pull/205#issuecomment-3254198310 to handle this in libmultiprocess instead of of bitcoin core.


    willcl-ark commented at 6:35 pm on September 4, 2025:
    I have extended https://github.com/bitcoin-core/libmultiprocess/pull/205 to include more helpful error messages when the capnproto package is not found by cmake.

    Sjors commented at 6:40 am on September 5, 2025:
    Let’s go for that approach then.
  28. hebasto referenced this in commit e1ce0c525c on Sep 4, 2025
  29. in cmake/libmultiprocess.cmake:12 in f39a782ba8
     7+  # which is included again by libmultiprocess. Skip the check when using the
     8+  # depends toolchain.
     9+  if(NOT (DEFINED CMAKE_TOOLCHAIN_FILE))
    10+    find_program(_CAPNP capnp)
    11+    if(NOT _CAPNP)
    12+      message(WARNING "Cap'n Proto (capnp) not found. Compile with -DENABLE_IPC=OFF if you do not need IPC functionality.")
    


    l0rinc commented at 6:52 pm on September 4, 2025:
    We might also want to mention that doc/build-*.md contains instructions for installing this new dependency, should they choose to not add -DENABLE_IPC=OFF
  30. l0rinc approved
  31. l0rinc commented at 6:53 pm on September 4, 2025: contributor
    Concept ACK
  32. davidgumberg commented at 10:44 pm on September 4, 2025: contributor

    Conceptual question:

    Why not print a warning and set(ENABLE_IPC OFF) when missing capnp? This was generally the approach taken in the old autotools build system. Is it better to force the user to confront the warning and change their configuration than to just try to build something reasonable based on what dependencies the user has?

  33. sipa commented at 10:51 pm on September 4, 2025: member
    @davidgumberg I believe that’s a philosophical difference between cmakeland and autotoolsland, and I think in the case of optional build dependencies, it’s better not to autodetect them, to avoid build system configuration leaking into the build (which then might not work on the system you actually want to run it on).
  34. Sjors commented at 6:41 am on September 5, 2025: member
  35. Sjors closed this on Sep 5, 2025

  36. Sjors commented at 6:43 am on September 5, 2025: member
    #33315 could be added to the v30 milestone so we don’t forget.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-09-10 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me