Ray's Knowledge Base
Unlock

A Debian bookworm image (g++ 12.2) is not a stand-in for the Ubuntu 22.04 gcc12 container (g++ 12.3)

PitfallVerified 19 Oct 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

On a lab-ws VM, the lab proxy (10.10.10.10:3128) answers 403 for every Ubuntu mirror, so docker/gcc12.Dockerfile (ubuntu:22.04) cannot run apt-get. Only deb.debian.org passes. An image with the same packages on debian:bookworm builds (g++ 12.2.0, CMake 3.25.1), but the dftracer-utils build then fails at tests/utilities/plugins/test_plugin_io_writer.cpp:178:1: error: array used as initializer (and line 310), pointing at the closing brace of a coroutine.

Cause#

The same file compiles with Ubuntu 22.04's g++ 12.3 (the gcc12 container passed 406 of 406 tests the same day). So g++ 12.2 differs in coroutine code generation. No bug report was checked.

Fix#

Do not use Debian's gcc-12 package for the gcc12 floor. Start from Docker Hub's official gcc:12.3 image (g++ 12.3.0 in /usr/local, Debian 12 base; Docker Hub passes the proxy), add the same apt packages from deb.debian.org, set CC=gcc CXX=g++ OMPI_CC=gcc OMPI_CXX=g++, and delete any build dir configured with the old compiler. Debian still pulls /usr/bin/g++-12 (12.2) in as a dependency, so check the "CXX compiler identification" line says 12.3.0.

Evidence#

2026-10-19, workspace dftu-gate on pve, branch feat/unified-allocator: cold build with sccache stopped at step 1418 of 1895 with the error above and 0 warnings before it.

Also found by searching

  • error: array used as initializer
  • Debian bookworm gcc 12.2 fails on coroutines that Ubuntu gcc 12.3 compiles
  • can I use Debian bookworm instead of Ubuntu 22.04 for the gcc12 container
  • lab proxy blocks archive.ubuntu.com 403 Forbidden