ci: bump oldest-supported gcc to 11; make matrix.cc actually pick the matrix version (#168)

* ci: make matrix.cc actually pick the matrix gcc version

The Build and Test workflow's matrix promises gcc-10 on ubuntu_22 and
gcc-13 on ubuntu_24, but until now both jobs were actually compiling
with the distro default (gcc-11 / gcc-13) for the bulk of the build.

Cause: ``apt-get install gcc-10`` only installs the versioned binaries
(``/usr/bin/gcc-10`` etc.); ``/usr/bin/gcc`` keeps pointing at the
system default. Blade resolves the compiler via ``shutil.which('gcc')``
and reads no environment variable, so the ``CC=gcc-10 CXX=g++-10`` env
prefix on the Build step was decorative for the main build. Only
thirdparty foreign_cc subbuilds, which read $CC, actually saw gcc-10.

Effect on ubuntu_22 (the more important case -- gcc-10 is the
oldest-supported compiler the matrix claims to cover): the matrix
labelled "gcc-10" was silently testing gcc-11 for everything blade
compiled directly. Real gcc-10 compatibility was not under test.

Fix: register the matrix version with update-alternatives in Install
dependencies. After this, ``which gcc`` resolves to the matrix
version; both blade's compiler discovery and ccache's dispatch see
the right one. Drop the decorative ``CC=...`` prefixes from the Build
and Run tests steps now that they are no longer load-bearing (and
would have been misleading to future readers).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* thirdparty/glog: patch self-referencing deprecated overload for gcc-10

PR #168 switched ubuntu_22_04 from the distro-default gcc-11 (which the
prior workflow was silently using) to the actually-promised gcc-10. That
flipped the lid on a long-standing latent issue in glog 0.7.1:

  glog/logging.h:494-505 declares a [[deprecated]] type alias
  `CustomPrefixCallback` inside a `#pragma GCC diagnostic
  push/ignored "-Wdeprecated-declarations"` block, then closes the
  pragma block, then declares a [[deprecated]] overload of
  `InitGoogleLogging` whose parameter type is `CustomPrefixCallback`.

gcc 11+ has a heuristic that suppresses deprecation warnings inside a
deprecated declaration's signature, so the overload's self-reference
stays silent. gcc 10 lacks that heuristic and fires
`-Werror=deprecated-declarations` on every TU pulling in <glog/logging.h>.

Patch (silence_self_deprecation.patch) moves the overload inside the
existing pragma block. No behavior change for callers; only the
internal self-reference stops warning. macOS clang and gcc 13 are
unaffected -- the diagnostic-suppression region simply covers slightly
more code on those toolchains too.

Verified by dry-run + real apply against a fresh extraction of
glog-0.7.1.tar.gz; the patched header preserves the original semantics.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* ci: bump oldest-supported gcc from 10 to 11

PR #168 made the matrix actually pick gcc-${{ matrix.cc }} instead of the
distro default (which was silently gcc-11 on ubuntu_22). With gcc-10 truly
exercised, two real incompatibilities surfaced:

1. flare/fiber/detail/scheduling_group.cc uses std::atomic<int>::wait,
   notify_one, notify_all (C++20 P1135). libstdc++ implements these
   starting in 11.1 only; gcc-10's <atomic> has no such members. PR #158
   introduced the dependency when it replaced the Linux-only futex(2)
   path with the portable C++20 primitives to make the macOS port work.

2. Several .cc files reference POSIX `unlink` without
   `#include <unistd.h>`. Newer libstdc++ stopped transitively pulling
   unistd through other headers.

Both are gcc-10 blockers we don't want to walk back -- atomic wait is
materially better than the futex path (portable, no syscall asymmetry).
Bump the matrix to gcc-11 and update the comment.

gcc-11 is the ubuntu-22.04 default, so the update-alternatives plumbing
becomes a no-op for this version but stays in place to keep future bumps
straightforward.

Keep the glog self-deprecation patch -- on gcc-11+ it is a no-op (the
heuristic suppresses the warning anyway), but it shields a local gcc-10
attempt from breaking on glog before the user even gets to the real
flare-side incompatibilities.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
CHEN Feng
2026-06-04 00:51:16 +08:00
committed by GitHub
parent 6df0c8d6c8
commit ed1e854280
3 changed files with 61 additions and 13 deletions
+19 -12
View File
@@ -7,15 +7,17 @@ on:
branches: [master]
jobs:
# Oldest supported compiler (gcc 10, first with usable C++20). Pinned to
# ubuntu-22.04 because GitHub's ubuntu-20.04 runners are deprecated and the
# queue can stall for tens of minutes. gcc-10 is still in 22.04's main archive.
# Oldest supported compiler (gcc 11, first libstdc++ with std::atomic
# wait/notify per P1135 -- required since #158 replaced the Linux-only
# futex path in fiber/detail/scheduling_group.cc). Pinned to ubuntu-22.04
# because GitHub's ubuntu-20.04 runners are deprecated and the queue can
# stall for tens of minutes; gcc-11 is the distro default for 22.04.
build_on_ubuntu_22_04:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10']
cc: [10]
cc: [11]
steps:
- uses: actions/checkout@v6
@@ -34,6 +36,13 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.cc }} g++-${{ matrix.cc }} ninja-build ccache
# Apt installs only the versioned binaries; /usr/bin/gcc still points
# at the distro default (gcc-11 on 22.04, gcc-13 on 24.04). Register
# the matrix version with update-alternatives so plain `gcc`/`g++`
# actually resolve to it -- otherwise blade's shutil.which('gcc')
# and ccache's compiler dispatch both pick up the wrong version.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.cc }} 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.cc }} 100
# /usr/lib/ccache holds symlinks (gcc, g++, gcc-10, ...) -> ccache.
# Prepending to PATH makes blade's shutil.which('gcc') resolve to the
# ccache shim; ccache then dispatches to the real compiler via its
@@ -63,13 +72,11 @@ jobs:
- name: ccache stats (before)
run: ccache --zero-stats && ccache --show-config
- name: Build
run: |
CC=gcc-${{ matrix.cc }} CXX=g++-${{ matrix.cc }} ./blade build ... -k
run: ./blade build ... -k
- name: ccache stats (after)
run: ccache --show-stats
- name: Run tests
run: |
CC=gcc-${{ matrix.cc }} CXX=g++-${{ matrix.cc }} ./blade test ...
run: ./blade test ...
# Latest compiler (gcc 13).
build_on_ubuntu_24_04:
@@ -91,6 +98,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.cc }} g++-${{ matrix.cc }} ninja-build ccache
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.cc }} 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.cc }} 100
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: Cache blade build dir
uses: actions/cache@v4
@@ -110,13 +119,11 @@ jobs:
- name: ccache stats (before)
run: ccache --zero-stats && ccache --show-config
- name: Build
run: |
CC=gcc-${{ matrix.cc }} CXX=g++-${{ matrix.cc }} ./blade build ... -k
run: ./blade build ... -k
- name: ccache stats (after)
run: ccache --show-stats
- name: Run tests
run: |
CC=gcc-${{ matrix.cc }} CXX=g++-${{ matrix.cc }} ./blade test ...
run: ./blade test ...
build_on_macos:
runs-on: macos-latest
+5 -1
View File
@@ -35,7 +35,11 @@ cmake_build(
'//thirdparty/gflags:gflags',
],
strip_include_prefix='glog',
patches=['no_export_guard.patch', 'build_static_with_shared.patch'],
patches=[
'no_export_guard.patch',
'build_static_with_shared.patch',
'silence_self_deprecation.patch',
],
generate_dynamic=True,
)
+37
View File
@@ -0,0 +1,37 @@
Suppress -Wdeprecated-declarations on glog's own deprecated overload.
Upstream 0.7.1's logging.h wraps the `CustomPrefixCallback` type alias
with `#pragma GCC diagnostic push/ignored "-Wdeprecated-declarations"`,
but the immediately following deprecated overload of `InitGoogleLogging`,
whose signature references `CustomPrefixCallback`, sits outside that
region.
gcc 11+ has a heuristic that suppresses deprecation warnings inside a
deprecated declaration's signature, so it stays silent there. gcc 10
lacks that heuristic and fires `-Werror=deprecated-declarations` on the
parameter type, breaking every TU that pulls in <glog/logging.h>.
Move the overload inside the existing pragma block. No behavior change
for callers; only the self-reference inside glog's own public header
stops warning.
--- a/src/glog/logging.h
+++ b/src/glog/logging.h
@@ -494,14 +494,14 @@
using CustomPrefixCallback
[[deprecated("Use PrefixFormatterCallback instead.")]] =
void (*)(std::ostream&, const LogMessageInfo&, void*);
+[[deprecated("Use InstallPrefixFormatter instead.")]] GLOG_EXPORT void
+InitGoogleLogging(const char* argv0, CustomPrefixCallback prefix_callback,
+ void* prefix_callback_data = nullptr);
#if defined(__GNUG__)
# pragma GCC diagnostic pop
#elif defined(_MSC_VER)
# pragma warning(pop)
#endif // __GNUG__
-[[deprecated("Use InstallPrefixFormatter instead.")]] GLOG_EXPORT void
-InitGoogleLogging(const char* argv0, CustomPrefixCallback prefix_callback,
- void* prefix_callback_data = nullptr);
// Check if google's logging library has been initialized.
GLOG_EXPORT bool IsGoogleLoggingInitialized();