Skip to content

ci: Add CAPNP_BUILD=autotools-static and enable in newdeps - #373

Open
mutatrum wants to merge 1 commit into
bitcoin-core:masterfrom
mutatrum:ci-autotools-static
Open

mutatrum wants to merge 1 commit into
bitcoin-core:masterfrom
mutatrum:ci-autotools-static

Conversation

@mutatrum

@mutatrum mutatrum commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This PR 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 adds autoconf, automake, and libtool to nativeBuildInputs in shell.nix for the nix environment.

As mentioned in #367 (review).

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.
@DrahtBot

DrahtBot commented Oct 2, 2026 •

Copy link
Copy Markdown

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

Reviews

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

Type Reviewers
Concept ACK ryanofsky

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #393 (ci: Add OpenIndiana job by hebasto)
  • #333 (nix: Make clang tooling and IWYU find the right standard library headers by ryanofsky)
  • #175 (Set cmake_minimum_required(VERSION 3.22) by maflcko)

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 ryanofsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread ci/configs/newdeps.bash
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
CAPNP_BUILD=autotools-static
CAPNP_BUILD=autotools-static # Check mpgen link order with capnpc.pc missing Requires: capnp (#367)

Comment thread ci/configs/newdeps.bash
Comment on lines 4 to +5
CAPNP_CHECKOUT=master # This is the v1.x release branch
CAPNP_BUILD=autotools-static

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ci/scripts/ci.sh
Comment on lines +29 to +41
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
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread shell.nix
git
include-what-you-use
libtool
ninja

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
ninja
ninja
pkg-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants