Skip to content

build: Bump g++ minimum supported version to 13 - #36042

Draft
maflcko wants to merge 10 commits into
bitcoin:masterfrom
maflcko:2608-gcc-13
Draft

maflcko wants to merge 10 commits into
bitcoin:masterfrom
maflcko:2608-gcc-13

Conversation

@maflcko

@maflcko maflcko commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

At some point, it may be fine to drop support for older vanilla systems not shipping with at least GCC 13.

(For this bump, only C++20 std::format will become available, but this bump should also pave the way for C++23.)

This patch will only be released in version 33.x, or later, next year (2027).

For reference:

On operating systems where the minimum GCC version is not shipped by default, the user would have to use Clang, or install GCC in a different way. For example:

Obviously, downloading pre-compiled releases or compiling previous release branches is unaffected by this change.

@DrahtBot DrahtBot changed the title build: Bump g++ minimum supported version to 13 build: Bump g++ minimum supported version to 13 Aug 20, 2026
@maflcko
maflcko marked this pull request as draft August 20, 2026 15:46
@DrahtBot

DrahtBot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

Reviews

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

Type Reviewers
Concept ACK hebasto, stickies-v

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:

  • #36147 (ci: add native freeBSD ci job by willcl-ark)
  • #35998 (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)

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.

@maflcko maflcko added this to the Future milestone Aug 20, 2026
@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task NetBSD Cross: https://github.com/bitcoin/bitcoin/actions/runs/32388090156/job/96487376676
LLM reason (✨ experimental): CI failed because CMake’s try-compile for text formatting errored with fatal error: 'format' file not found (missing C++ <format> header).

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@maflcko

maflcko commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

Hmm, looks like netbsd-cross is a CI blocker for this? Not sure how to proceed here, because netbsd ci coverage may be useful, but no real user is doing netbsd-cross (I expect all users are running on native netbsd). But native netbsd isn't an option for CI ... 🤷‍♂️

@fanquake

Copy link
Copy Markdown
Member

but no real user is doing netbsd-cross (I expect all users are running on native netbsd). But native netbsd isn't an option for CI ...

Are you saying this does work natively on NetBSD? I'd expect it to fail the same way (given NetBSD 11 ships GCC 12.5.0 which doesn't support std::format), and the CI here is giving us the coverage we want (showing this would break compilation for native NetBSD users)?

@maflcko

maflcko commented Aug 21, 2026 •

Copy link
Copy Markdown
Member Author

NetBSD also has recent GCC in packages, so it should work natively on NetBSD. But I don't really know an answer to the meta question, or how to proceed here, which is why this is in draft and removed from the milestone.

References:

@fanquake

Copy link
Copy Markdown
Member

I guess somebody (maybe @hebasto?) could test a newer version of GCC natively, to determine which compiler/flag combo is required for std::format, and then update the build instructions. Could be good to do in any case, if NetBSD users are currently using GCC 12.x.

@hebasto

hebasto commented Aug 22, 2026

Copy link
Copy Markdown
Member

I guess somebody (maybe @hebasto?) could test a newer version of GCC natively, to determine which compiler/flag combo is required for std::format, and then update the build instructions. Could be good to do in any case, if NetBSD users are currently using GCC 12.x.

Yes, it's possible to install a newer GCC compiler and configure the build system to use it (similar to what was documented prior to 9b85c98).

For example, on my NetBSD 11.0 system:

$ sudo pkgin install gcc15
$ cmake --preset dev-mode -DCMAKE_C_COMPILER=/usr/pkg/gcc15/bin/gcc -DCMAKE_CXX_COMPILER=/usr/pkg/gcc15/bin/g++ -DWITH_USDT=OFF -DENABLE_IPC=OFF

However, there is a minor issue caused by the base system and pkgsrc using different versions of libstdc++:

/usr/bin/ld: warning: libstdc++.so.9, needed by /usr/pkg/lib/libzmq.so, may conflict with libstdc++.so.7

and

$ ldd build_dev_mode/bin/bitcoind
build_dev_mode/bin/bitcoind:
	-lzmq.5 => /usr/pkg/lib/libzmq.so.5
	-lrt.1 => /usr/lib/librt.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lpthread.1 => /usr/lib/libpthread.so.1
	-lstdc++.9 => /usr/lib/libstdc++.so.9
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/pkg/gcc15/lib/./libgcc_s.so.1
	/usr/pkg/lib/libsqlite3.so => /usr/pkg/lib/libsqlite3.so
	-lstdc++.7 => /usr/pkg/gcc15/lib/./libstdc++.so.7

@maflcko

maflcko commented Aug 22, 2026

Copy link
Copy Markdown
Member Author

However, there is a minor issue caused by the base system and pkgsrc using different versions of libstdc++:

So the same issue previously existed on NetBSD 10? So the only way to compile on NetBSD is with depends (or self-compiling all deps)?

@hebasto

hebasto commented Aug 22, 2026 •

Copy link
Copy Markdown
Member

However, there is a minor issue caused by the base system and pkgsrc using different versions of libstdc++:

So the same issue previously existed on NetBSD 10?

Yes.

So the only way to compile on NetBSD is with depends (or self-compiling all deps)?

Those linker warnings seem harmless, though.

As for "self-compiling all deps", only the C++ deps from pkgsrc actually need to be rebuilt. For an example of this, see hebasto/bitcoin-core-nightly#117.

@hebasto hebasto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Concept ACK.

@stickies-v

Copy link
Copy Markdown
Contributor

Concept ACK

@maflcko

maflcko commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Went ahead and dropped NetBSD-cross from the GHA matrix. While it is possible to keep and maintain it, it would be tedious, with questionable benefit, given that the task hasn't found a meaningful issue unique to the NetBSD-cross task.

@hebasto

hebasto commented Oct 22, 2026

Copy link
Copy Markdown
Member

We already had a situation before the NetBSD 11.0 release where NetBSD’s base compiler did not meet our minimum requirements. Back then, the NetBSD build notes provided instructions for installing a newer compiler. Moreover, due to a bug in capnproto, it seems prudent to recommend GCC 14 and skip GCC 13.

Went ahead and dropped NetBSD-cross from the GHA matrix.

I agree with that. Its value has been moderate recently, as most NetBSD-specific issues have been caught by running the tests elsewhere.

I hope we can proceed with this PR and undraft it, as GCC 12 is currently broken on some platforms anyway.

@maflcko

maflcko commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

I hope we can proceed with this PR and undraft it

Ok, I'll think if it makes sense to git revert 9b85c98 (with gcc14), and then undraft

MarcoFalke added 7 commits November 23, 2026 14:07
Make an example replacement to use std::format. New code can use this
now, but old code can probably stay as-is for now.
This bump is required, because the prior minor version was nuked from
the archives.

The removal is required, because the CI would otherwise fail in the
future when this pkg is nuked as well.

A fix could be to set up a mirror of the pkg, but this is tedious to
maintain. Given that there is still full coverage of FreeBSD and OpenBSD
cross-compilation, and this task not yet having found an issue, it seems
fine to drop it for now.

The config is retained, so that anyone can still run and maintain it
locally, if needed. This is similar to other CI tasks, such as s390x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants