From fa807f78aede4bc59a75366899fd5752ce6a66f8 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 10 Nov 2025 16:11:45 +0100 Subject: [PATCH 1/7] build: Bump g++ minimum supported version to 12 --- ci/test/00_setup_env_native_previous_releases.sh | 6 +++--- doc/dependencies.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/test/00_setup_env_native_previous_releases.sh b/ci/test/00_setup_env_native_previous_releases.sh index d9f8d3bfc90..19b9c66b44d 100755 --- a/ci/test/00_setup_env_native_previous_releases.sh +++ b/ci/test/00_setup_env_native_previous_releases.sh @@ -8,9 +8,9 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_previous_releases export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:22.04" -# Use minimum supported python3.10 and gcc-11, see doc/dependencies.md -export PACKAGES="gcc-11 g++-11 python3-zmq" -export DEP_OPTS="CC=gcc-11 CXX=g++-11" +# Use minimum supported python3.10 and gcc-12, see doc/dependencies.md +export PACKAGES="gcc-12 g++-12 python3-zmq" +export DEP_OPTS="CC=gcc-12 CXX=g++-12" export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash export GOAL="install" export CI_LIMIT_STACK_SIZE=1 diff --git a/doc/dependencies.md b/doc/dependencies.md index 77391f74ae9..3ff306f8828 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -11,7 +11,7 @@ Bitcoin Core requires one of the following compilers. | Dependency | Minimum required | | --- | --- | | [Clang](https://clang.llvm.org) | [17.0](https://github.com/bitcoin/bitcoin/pull/33555) | -| [GCC](https://gcc.gnu.org) | [11.1](https://github.com/bitcoin/bitcoin/pull/29091) | +| [GCC](https://gcc.gnu.org) | [12.1](https://github.com/bitcoin/bitcoin/pull/33842) | ## Required From fa9dacdbde7dc18d134019bdad24f47e4dea1dda Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 10 Nov 2025 16:43:11 +0100 Subject: [PATCH 2/7] util: [refactor] Remove unused create_directories workaround This was added in commit 1f46b6e46e1454b91ff7ceb31853bc440952f8eb, but is no longer needed after g++-12 is the minimum required. --- src/util/fs.h | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/util/fs.h b/src/util/fs.h index 8b5c0460257..147904d030a 100644 --- a/src/util/fs.h +++ b/src/util/fs.h @@ -185,29 +185,6 @@ static inline path PathFromString(const std::string& string) return std::filesystem::path(string); #endif } - -/** - * Create directory (and if necessary its parents), unless the leaf directory - * already exists or is a symlink to an existing directory. - * This is a temporary workaround for an issue in libstdc++ that has been fixed - * upstream [PR101510]. - * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510 - */ -static inline bool create_directories(const std::filesystem::path& p) -{ - if (std::filesystem::is_symlink(p) && std::filesystem::is_directory(p)) { - return false; - } - return std::filesystem::create_directories(p); -} - -/** - * This variant is not used. Delete it to prevent it from accidentally working - * around the workaround. If it is needed, add a workaround in the same pattern - * as above. - */ -bool create_directories(const std::filesystem::path& p, std::error_code& ec) = delete; - } // namespace fs /** Bridge operations to C stdio */ From fa3854e43295f71f5dad8557dd621f0f799b0ee0 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Nov 2025 16:59:45 +0100 Subject: [PATCH 3/7] test: Remove unused fs::create_directories test The test was added in commit ddb75c2e87a60ed24065bdf0c3bfabf4e058cef1. After the create_directories wrapper removal, the test is redundant with the unit test in the upstream stdlib. Also, there is a Bitcoin Core functional test that covers this behavior in test/functional/feature_dirsymlinks.py So remove this unit test. Finally, I could not find a real system that still ships a buggy stdlib (v11.2) in their package manager. A stand-alone test is also available in compiler-explorer under https://godbolt.org/z/aeMKraYrT. --- src/test/fs_tests.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/test/fs_tests.cpp b/src/test/fs_tests.cpp index 28fcf952e52..89188904b5d 100644 --- a/src/test/fs_tests.cpp +++ b/src/test/fs_tests.cpp @@ -139,28 +139,4 @@ BOOST_AUTO_TEST_CASE(rename) fs::remove(path2); } -#ifndef __MINGW64__ // no symlinks on mingw -BOOST_AUTO_TEST_CASE(create_directories) -{ - // Test fs::create_directories workaround. - const fs::path tmpfolder{m_args.GetDataDirBase()}; - - const fs::path dir{tmpfolder / "a"}; - fs::create_directory(dir); - BOOST_CHECK(fs::exists(dir)); - BOOST_CHECK(fs::is_directory(dir)); - BOOST_CHECK(!fs::create_directories(dir)); - - const fs::path symlink{tmpfolder / "b"}; - fs::create_directory_symlink(dir, symlink); - BOOST_CHECK(fs::exists(symlink)); - BOOST_CHECK(fs::is_symlink(symlink)); - BOOST_CHECK(fs::is_directory(symlink)); - BOOST_CHECK(!fs::create_directories(symlink)); - - fs::remove(symlink); - fs::remove(dir); -} -#endif // __MINGW64__ - BOOST_AUTO_TEST_SUITE_END() From fabce97b303bd4aafa98ceb11c63800e7f4f11cd Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Nov 2025 22:16:14 +0100 Subject: [PATCH 4/7] test: Remove gccbug_90348 test case The test case no longer detects this specific issue for GCC versions 12.1+, as explained in the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 thread and in this compiler-explorer playground: https://godbolt.org/z/Y48osrjM8 So remove the test case and update the -fstack-reuse=none cmake docstring with the underlying affected GCC versions, and the bug URL. --- CMakeLists.txt | 4 ++-- src/test/CMakeLists.txt | 1 - src/test/compilerbug_tests.cpp | 42 ---------------------------------- 3 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 src/test/compilerbug_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3749cf7c60e..a747a1b5729 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -493,8 +493,8 @@ try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}/src=." ) -# Currently all versions of gcc are subject to a class of bugs, see the -# gccbug_90348 test case (only reproduces on GCC 11 and earlier) and +# GCC versions 13.2 (and earlier) are subject to a class of bugs, see +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 and the meta bug # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set # -fstack-reuse=none for all gcc builds. (Only gcc understands this flag). try_append_cxx_flags("-fstack-reuse=none" TARGET core_interface) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index a67cd241764..9528004e988 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -34,7 +34,6 @@ add_executable(test_bitcoin coinscachepair_tests.cpp coinstatsindex_tests.cpp common_url_tests.cpp - compilerbug_tests.cpp compress_tests.cpp crypto_tests.cpp cuckoocache_tests.cpp diff --git a/src/test/compilerbug_tests.cpp b/src/test/compilerbug_tests.cpp deleted file mode 100644 index ef558c1e322..00000000000 --- a/src/test/compilerbug_tests.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2019-2021 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -BOOST_AUTO_TEST_SUITE(compilerbug_tests) - -#if defined(__GNUC__) -// This block will also be built under clang, which is fine (as it supports noinline) -void __attribute__ ((noinline)) set_one(unsigned char* ptr) -{ - *ptr = 1; -} - -int __attribute__ ((noinline)) check_zero(unsigned char const* in, unsigned int len) -{ - for (unsigned int i = 0; i < len; ++i) { - if (in[i] != 0) return 0; - } - return 1; -} - -void set_one_on_stack() { - unsigned char buf[1]; - set_one(buf); -} - -BOOST_AUTO_TEST_CASE(gccbug_90348) { - // Test for GCC bug 90348. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 - for (int i = 0; i <= 4; ++i) { - unsigned char in[4]; - for (int j = 0; j < i; ++j) { - in[j] = 0; - set_one_on_stack(); // Apparently modifies in[0] - } - BOOST_CHECK(check_zero(in, i)); - } -} -#endif - -BOOST_AUTO_TEST_SUITE_END() From faa8be75c9470d7d28b0993b723ef1a36a6f58cd Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Sat, 8 Nov 2025 12:03:03 +0100 Subject: [PATCH 5/7] ci: Enable experimental kernel stuff in G++-12 task (previous releases) Base the task on --preset=dev-mode to ensure maximal coverage and add the following: bitcoin-chainstate (experimental) ... ON libbitcoinkernel (experimental) ..... ON kernel-test (experimental) .......... ON Also, shorten the name, for a less cluttered web view. --- .github/workflows/ci.yml | 2 +- ci/test/00_setup_env_native_previous_releases.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3801c187faa..d433646292f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -510,7 +510,7 @@ jobs: timeout-minutes: 240 file-env: './ci/test/00_setup_env_native_fuzz_with_valgrind.sh' - - name: 'previous releases, depends DEBUG' + - name: 'previous releases' cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md' fallback-runner: 'ubuntu-24.04' timeout-minutes: 120 diff --git a/ci/test/00_setup_env_native_previous_releases.sh b/ci/test/00_setup_env_native_previous_releases.sh index 19b9c66b44d..a44a51c37a4 100755 --- a/ci/test/00_setup_env_native_previous_releases.sh +++ b/ci/test/00_setup_env_native_previous_releases.sh @@ -16,7 +16,8 @@ export GOAL="install" export CI_LIMIT_STACK_SIZE=1 export DOWNLOAD_PREVIOUS_RELEASES="true" export BITCOIN_CONFIG="\ - -DWITH_ZMQ=ON -DBUILD_GUI=ON -DREDUCE_EXPORTS=ON \ + --preset=dev-mode \ + -DREDUCE_EXPORTS=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_FLAGS='-funsigned-char' \ -DCMAKE_C_FLAGS_DEBUG='-g2 -O2' \ From fa1711ee0d3bac12daa7fdac04af448b69cc257a Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Nov 2025 22:26:36 +0100 Subject: [PATCH 6/7] doc: Add GCC-12 min release notes --- doc/release-notes-33842.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/release-notes-33842.md diff --git a/doc/release-notes-33842.md b/doc/release-notes-33842.md new file mode 100644 index 00000000000..ad15f50b28b --- /dev/null +++ b/doc/release-notes-33842.md @@ -0,0 +1,4 @@ +Build System +------------ + +- The minimum supported GCC compiler version has been raised to 12.1 (#33842). From fa9f29a4a79944f6ffbb58eab0ac41e243fbeb97 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 10 Nov 2025 17:32:35 +0100 Subject: [PATCH 7/7] doc: Recommend latest Debian stable or Ubuntu LTS --- doc/build-unix.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/build-unix.md b/doc/build-unix.md index d9bbb350a7a..e499aa9b0f1 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -46,10 +46,14 @@ Finally, clang (often less resource hungry) can be used instead of gcc, which is #### Dependency Build Instructions -Build requirements: +Build requirements for the latest Debian "stable" release, or the latest Ubuntu LTS release: sudo apt-get install build-essential cmake pkgconf python3 +For Debian "oldstable", or earlier Ubuntu LTS releases, you may need to pick a +later compiler version, according to the [dependencies](/doc/dependencies.md) +documentation. + Now, you can either build from self-compiled [depends](#dependencies) or install the required dependencies: sudo apt-get install libevent-dev libboost-dev