Repository navigation
Conversation
Add support for CAPNP_BUILD=autotools-static in ci/scripts/ci.sh so Cap'n Proto can be built from source using autotools instead of cmake. This provides CI coverage for static linking against autotools-built Cap'n Proto libraries and ensures link order regressions are caught. Enable CAPNP_BUILD=autotools-static in newdeps, and add autoconf, automake, and libtool to nativeBuildInputs in shell.nix for the nix environment.
|
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.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
ryanofsky
left a comment
There was a problem hiding this comment.
Concept ACK 3c13c7d. This adds CI coverage for the static Cap'n Proto link order fixed in #367, which nothing tested before. Thanks for following up and adding it!
The change looks good. The only issue I see is that shell.nix needs pkg-config, which CI only finds outside the nix shell and can break running CI scripts locally (see the inline comment).
| CI_DIR=build-newdeps | ||
| export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-error=array-bounds" | ||
| CAPNP_CHECKOUT=master # This is the v1.x release branch | ||
| CAPNP_BUILD=autotools-static |
There was a problem hiding this comment.
In commit "ci: Add CAPNP_BUILD=autotools-static and enable in newdeps" (3c13c7d)
Could add a comment saying why this is here, so a later cleanup doesn't drop it, since nothing else in this file explains it:
| CAPNP_BUILD=autotools-static | |
| CAPNP_BUILD=autotools-static # Check mpgen link order with capnpc.pc missing Requires: capnp (#367) |
| CAPNP_CHECKOUT=master # This is the v1.x release branch | ||
| CAPNP_BUILD=autotools-static |
There was a problem hiding this comment.
In commit "ci: Add CAPNP_BUILD=autotools-static and enable in newdeps" (3c13c7d)
One trade-off with turning this on in newdeps: newdeps was the only job building Cap'n Proto master with CMake, and after this nothing tests the CMake package files from capnp master before a release. Bitcoin Core's depends builds capnp with CMake (capnp.mk), so that is the packaging Bitcoin Core relies on. I think this is fine (I suggested "newdeps or a new config" in #367 (review)) but if we add more jobs later it could make sense to move this to a different job.
| if [ "${CAPNP_BUILD-}" = "autotools-static" ]; then | ||
| ( | ||
| cd capnp/c++ | ||
| git --no-pager log -1 || true | ||
| autoreconf -i | ||
| ./configure --prefix="${capnp_prefix}" \ | ||
| --disable-shared \ | ||
| --enable-static \ | ||
| --without-openssl \ | ||
| --without-zlib \ | ||
| CXXFLAGS="-std=c++20" | ||
| make -j"$(nproc)" install | ||
| ) |
There was a problem hiding this comment.
In commit "ci: Add CAPNP_BUILD=autotools-static and enable in newdeps" (3c13c7d)
Note: I checked that this setup catches the problem fixed in #367. With Cap'n Proto master built this way and the mpgen link order from before #367 (56cfdaa reverted), mpgen fails to link with the same undefined reference to capnp::SchemaLoader::get(...) errors as the #367 reproduction. Cap'n Proto master's capnpc.pc still doesn't list capnp in Requires, so the job keeps testing this until that changes upstream.
| git | ||
| include-what-you-use | ||
| libtool | ||
| ninja |
There was a problem hiding this comment.
In commit "ci: Add CAPNP_BUILD=autotools-static and enable in newdeps" (3c13c7d)
I think pkg-config needs to be added here too. An autotools install of Cap'n Proto only has the pkg-config based CapnProtoTargets.cmake, which sets CapnProto_FOUND to false if pkg-config is missing. The newdeps job only passes because CMake falls back to the runner's system copy (Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") in the log), even though the nix shell runs with --ignore-environment. I checked this on NixOS, which has no /usr/bin/pkg-config: with Cap'n Proto master built as in this PR, the cmake step fails with pkg-config cannot be found, and with the change below it builds and the tests pass.
| ninja | |
| ninja | |
| pkg-config |
This PR add support for
CAPNP_BUILD=autotools-staticinci/scripts/ci.shso Cap'n Proto can be built from source usingautotoolsinstead ofcmake. This provides CI coverage for static linking against autotools-built Cap'n Proto libraries and ensures link order regressions are caught.Enable
CAPNP_BUILD=autotools-staticinnewdeps, and addsautoconf,automake, andlibtooltonativeBuildInputsinshell.nixfor the nix environment.As mentioned in #367 (review).