ipc: Fix mpgen capnp tool path for vcpkg/Windows builds #317

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/win-cmake changing 2 files +13 −3
  1. ryanofsky commented at 5:17 PM on July 22, 2026: collaborator

    It seems that in the vcpkg capnproto package, the capnp code generator can't be found in <capnp_PREFIX>/bin/capnp but is in another path that needs to be read from the cmake configuration, so this change adds cmake code to handle that.

    Unfortunately the previous code using <capnp_PREFIX>/bin can't be removed because the llbcapnp-dev 1.0.1 package in Ubuntu Noble is buggy and specifies the wrong executable path in its cmake information. (If this problem is fixed, the old capnp_PREFIX code could be dropped.)

    This change is needed to get MSVC builds working in https://github.com/bitcoin/bitcoin/pull/32387

  2. cmake: Fix mpgen capnp tool path for vcpkg/Windows builds
    Error seen (MSVC native build):
      mpgen error: mp\util.cpp:332: failed: CreateProcessA(...): #2 The system
      cannot find the file specified.
    
    Problem: mpgen constructs capnp tool paths as capnp_PREFIX + "/bin/capnp"
    and capnp_PREFIX + "/bin/capnpc-c++". capnp_PREFIX is derived from the
    capnproto include directory parent, so on a vcpkg install it resolves to
    something like vcpkg_installed/x64-windows-release. But vcpkg installs
    executables under tools/capnproto/, not bin/, so the constructed path
    does not exist and CreateProcessA fails with ERROR_FILE_NOT_FOUND.
    
    Fix: pass the CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE cmake variables
    from CapnProtoConfig.cmake as compile definitions to mpgen, and use them
    in gen.cpp instead of constructing paths from capnp_PREFIX.
    
    Using these cmake variables rather than reading the CapnProto::capnp_tool
    imported target IMPORTED_LOCATION directly is important: on Debian/Ubuntu,
    IMPORTED_LOCATION is set to a non-existent path due to a multiarch cmake
    packaging bug in libcapnp-dev (see
    https://github.com/bitcoin-core/libmultiprocess/issues/328). The cmake
    variables avoid this because CapnProtoConfig.cmake hardcodes the correct
    paths on Debian/Ubuntu, and on other platforms (including vcpkg) the
    variables hold generator expressions that target_compile_definitions
    evaluates correctly at generation time.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    a26a08496b
  3. DrahtBot commented at 5:17 PM on July 22, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK hebasto

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. hebasto commented at 11:37 PM on July 31, 2026: member

    I reviewed 049dae17b5d0b59858e6ead1dec40e5e778f44d7 and played with the code on Windows using the following vcpkg.json file:

    {
      "$comment": "The builtin-baseline corresponds to 2025.08.27 Release",
      "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
      "builtin-baseline": "120deac3062162151622ca4860575a33844ba10b",
      "dependencies": [
        "capnproto"
      ]
    }
    

    The code works. However, I believe the build system could do better and always define CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE to verified paths. See this branch: https://github.com/hebasto/libmultiprocess/commits/pr317/0731.alt/ Additionally, the code is organised into a function, and unnecessary quotes are removed.

    Feel free to pick any part of that branch.

  5. ryanofsky force-pushed on Aug 1, 2026
  6. ryanofsky commented at 1:44 PM on August 1, 2026: collaborator

    Thanks for the review! I dug into the debian bug a little more and think I found a simpler workaround. The details of the bug are in #328. I will push an update to https://github.com/bitcoin/bitcoin/pull/32387 including this workaround so we can be sure it still works for MSVC.


    <!-- begin push-2 -->

    Updated 049dae17b5d0b59858e6ead1dec40e5e778f44d7 -> a26a08496b8bd9c43999e3636f9f53ec9022d124 (pr/win-cmake.1 -> pr/win-cmake.2, compare)<!-- end --> switching to simpler workaround for the debian packaging bug

  7. hebasto approved
  8. hebasto commented at 6:06 PM on August 1, 2026: member

    ACK a26a08496b8bd9c43999e3636f9f53ec9022d124, I've verified CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE values on Ubuntu 24.04, Fedora 44 and Windows 11.

  9. ryanofsky merged this on Aug 3, 2026
  10. ryanofsky closed this on Aug 3, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-05 20:30 UTC

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