`test_kernel` fails to build on Ubuntu 22.04 #33846

issue hebasto opened this issue on November 10, 2025
  1. hebasto commented at 5:01 PM on November 10, 2025: member
    $ sudo apt update
    $ sudo apt install git build-essential cmake pkgconf python3 libevent-dev libboost-dev libsqlite3-dev
    $ git clone https://github.com/bitcoin/bitcoin.git && cd bitcoin
    $ cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON
    $ cmake --build build -j $(nproc)
    <snip>
    [ 76%] Building CXX object src/test/kernel/CMakeFiles/test_kernel.dir/test_kernel.cpp.o
    /bitcoin/src/test/kernel/test_kernel.cpp:17:10: fatal error: format: No such file or directory
       17 | #include <format>
          |          ^~~~~~~~
    compilation terminated.
    gmake[2]: *** [src/test/kernel/CMakeFiles/test_kernel.dir/build.make:76: src/test/kernel/CMakeFiles/test_kernel.dir/test_kernel.cpp.o] Error 1
    gmake[1]: *** [CMakeFiles/Makefile2:1251: src/test/kernel/CMakeFiles/test_kernel.dir/all] Error 2
    gmake[1]: *** Waiting for unfinished jobs....
    [ 76%] Linking CXX static library ../lib/libbitcoin_node.a
    [ 76%] Built target bitcoin_node
    gmake: *** [Makefile:146: all] Error 2
    
  2. hebasto commented at 5:01 PM on November 10, 2025: member
  3. kevkevinpal commented at 4:06 AM on November 11, 2025: contributor

    If you want to reproduce using docker here is the docker file

    FROM ubuntu:22.04
    
    RUN apt update && \
        apt install -y git build-essential cmake pkgconf python3 libevent-dev libboost-dev libsqlite3-dev
    
    WORKDIR /bitcoin
    RUN git clone https://github.com/bitcoin/bitcoin.git .
    
    RUN cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON && \
        cmake --build build -j $(nproc)
    
  4. maflcko commented at 7:48 AM on November 11, 2025: member

    Please remove the include. See https://github.com/bitcoin/bitcoin/actions/runs/19176694315/job/54823183155?pr=33810#step:9:18532 :

     /home/admin/actions-runner/_work/_temp/src/test/kernel/test_kernel.cpp should remove these lines:
    - #include <boost/test/included/unit_test.hpp>  // lines 9-9
    - #include <cstdlib>  // lines 15-15
    - #include <format>  // lines 17-17
    
  5. maflcko added the label Refactoring on Nov 11, 2025
  6. maflcko added the label Tests on Nov 11, 2025
  7. fanquake commented at 3:30 PM on November 11, 2025: member

    Note that this will still fail:

    [ 74%] Building CXX object src/test/kernel/CMakeFiles/test_kernel.dir/test_kernel.cpp.o
    /bitcoin/src/test/kernel/test_kernel.cpp: In member function 'void btck_transaction_tests::test_method()':
    /bitcoin/src/test/kernel/test_kernel.cpp:448:34: error: no match for 'operator|' (operand types are 'btck::Range<btck::Transaction, &btck::TransactionApi<btck::Transaction>::CountOutputs, &btck::TransactionApi<btck::Transaction>::GetOutput>' and 'std::ranges::views::__adaptor::_Partial<std::ranges::views::_Filter, btck_transaction_tests::test_method()::<lambda(const auto:22&)> >')
      448 |     auto amount = *(tx.Outputs() | std::ranges::views::filter([](const auto& output) {
          |                     ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                               |                              |
          |                               |                              std::ranges::views::__adaptor::_Partial<std::ranges::views::_Filter, btck_transaction_tests::test_method()::<lambda(const auto:22&)> >
          |                               btck::Range<btck::Transaction, &btck::TransactionApi<btck::Transaction>::CountOutputs, &btck::TransactionApi<btck::Transaction>::GetOutput>
      449 |                         return output.Amount() == 42130042;
          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      450 |                     }) |
          |                     ~~       
    
  8. maflcko commented at 4:00 PM on November 11, 2025: member

    The unused format include is removed in https://github.com/bitcoin/bitcoin/pull/33853/files and the rvalue ranges thing (ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113154) is "fixed" in #33842.

    An alternative could be to use an lvalue. However, I am not sure if this is worth it:

    diff --git a/src/test/kernel/test_kernel.cpp b/src/test/kernel/test_kernel.cpp
    index d9875ee..6ef494b 100644
    --- a/src/test/kernel/test_kernel.cpp
    +++ b/src/test/kernel/test_kernel.cpp
    @@ -14,7 +14,7 @@
     #include <cstdint>
     #include <cstdlib>
     #include <filesystem>
    -#include <format>
    +//#include <format>
     #include <iostream>
     #include <memory>
     #include <optional>
    @@ -446,12 +446,14 @@ BOOST_AUTO_TEST_CASE(btck_transaction_tests)
         }
         BOOST_CHECK_EQUAL(total_amount, 62867453);
     
    -    auto amount = *(tx.Outputs() | std::ranges::views::filter([](const auto& output) {
    +    auto amount = [&](){
    +           auto tx_outputs{tx.Outputs()};
    +           return *(tx_outputs | std::ranges::views::filter([](const auto& output) {
                             return output.Amount() == 42130042;
                         }) |
                         std::views::transform([](const auto& output) {
                             return output.Amount();
    -                    })).begin();
    +                    })).begin();}();
         BOOST_REQUIRE(amount);
         BOOST_CHECK_EQUAL(amount, 42130042);
     
    @@ -735,9 +737,9 @@ void chainman_mainnet_validation_test(TestDirectory& test_directory)
         for (auto transaction : block.Transactions()) {
             BOOST_CHECK_EQUAL(transaction.CountInputs(), 1);
         }
    -    auto output_counts = *(block.Transactions() | std::views::transform([](const auto& tx) {
    +    auto output_counts = [&](){auto txs{block.Transactions()};return *(txs | std::views::transform([](const auto& tx) {
                                    return tx.CountOutputs();
    -                           })).begin();
    +                           })).begin();}();
         BOOST_CHECK_EQUAL(output_counts, 1);
     
         validation_interface->m_expected_valid_block.emplace(raw_block);
    
  9. kevkevinpal commented at 11:18 PM on November 11, 2025: contributor

    An alternative could be to use an lvalue. However, I am not sure if this is worth it:

    I think it might make most sense to continue with #33842 and to bump the min version of g++ to 12 and above as you mentioned

  10. maflcko added this to the milestone 31.0 on Nov 12, 2025
  11. maflcko closed this on Nov 12, 2025

  12. kevkevinpal commented at 3:33 PM on November 12, 2025: contributor

    Just tested on master commit d4e2a458330512c227b475531e1617d25366be54 and the build still failed with this docker file

    FROM ubuntu:22.04
    
    RUN apt update
    RUN apt install -y git build-essential cmake pkgconf python3 libevent-dev libboost-dev libsqlite3-dev
    
    COPY . /bitcoin
    WORKDIR /bitcoin
    
    RUN cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON
    RUN cmake --build build -j1
    

    are we sure #33853 closes this issue? @fanquake

  13. hebasto commented at 3:49 PM on November 12, 2025: member
    RUN cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON
    

    It should be now:

    cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12
    
  14. fanquake commented at 3:50 PM on November 12, 2025: member

    Just tested on master commit https://github.com/bitcoin/bitcoin/commit/d4e2a458330512c227b475531e1617d25366be54 and the build still failed with this docker file

    The minimum required GCC is now 12; however that Dockerfile will install 11. If you install and use 12, it will work.

  15. kevkevinpal commented at 4:35 PM on November 12, 2025: contributor

    Just tested on master commit d4e2a45 and the build still failed with this docker file

    The minimum required GCC is now 12; however that Dockerfile will install 11. If you install and use 12, it will work.

    ok gotcha I assumed #33853 alone closed the issue, will attempt to build again using GCC 12

  16. kevkevinpal commented at 4:58 PM on November 12, 2025: contributor

    thanks! I was able to get it to build with GCC 12 with this Docker build script

    FROM ubuntu:22.04
    
    RUN apt update
    RUN apt install -y git build-essential cmake pkgconf python3 libevent-dev libboost-dev libsqlite3-dev gcc-12 g++-12
    
    COPY . /bitcoin
    WORKDIR /bitcoin
    
    RUN cmake -B build -DENABLE_IPC=OFF -DBUILD_KERNEL_LIB=ON -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12
    RUN cmake --build build -j1
    

Milestone
31.0


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: 2026-04-22 09:12 UTC

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