ipc: Fix mpgen capnp tool path for vcpkg/Windows builds#317
Open
ryanofsky wants to merge 1 commit into
Open
Conversation
Error seen (MSVC native build): mpgen error: mp\util.cpp:332: failed: CreateProcessA(...): bitcoin-core#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: in CMakeLists.txt, when cmake has CapnProto::capnp_tool and CapnProto::capnpc_cpp imported executable targets with valid IMPORTED_LOCATION paths, pass those paths as CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE compile definitions to mpgen. gen.cpp uses them via #ifdef, falling back to the capnp_PREFIX construction when they are not defined. The EXISTS check before setting the define is important: Ubuntu Noble's libcapnp-dev 1.0.1 has a packaging bug where the cmake config file is installed under /usr/lib/x86_64-linux-gnu/cmake/ but _IMPORT_PREFIX is only computed up 3 directory levels to /usr/lib instead of 4 to /usr, so IMPORTED_LOCATION is set to /usr/lib/bin/capnp which doesn't exist. The EXISTS check catches this, leaves CAPNP_EXECUTABLE undefined, and gen.cpp falls back to capnp_PREFIX "/bin/capnp" = /usr/bin/capnp which does exist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline and AI policy for information on the review process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems that in the vcpkg capnproto package, the
capnpcode generator can't be found in<capnp_PREFIX>/bin/capnpbut 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>/bincan'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 oldcapnp_PREFIXcode could be dropped.)This change is needed to get MSVC builds working in bitcoin/bitcoin#32387