Draft
Pin Ubuntu libstdc++ runtime before dist-upgrade and make stdlib version check major-series based#521
Conversation
Agent-Logs-Url: https://github.com/envoyproxy/envoy-build-tools/sessions/a193577c-c1ea-4a6c-9cda-ba92aaf00265 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/envoy-build-tools/sessions/a193577c-c1ea-4a6c-9cda-ba92aaf00265 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/envoy-build-tools/sessions/a193577c-c1ea-4a6c-9cda-ba92aaf00265 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/envoy-build-tools/sessions/a193577c-c1ea-4a6c-9cda-ba92aaf00265 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Agent-Logs-Url: https://github.com/envoyproxy/envoy-build-tools/sessions/a193577c-c1ea-4a6c-9cda-ba92aaf00265 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Pin libstdc++6 to gcc-13 series to prevent upgrade issues
Pin Ubuntu libstdc++ runtime before dist-upgrade and make stdlib version check major-series based
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
install_basewas allowingdist-upgradeto pulllibstdc++6from newer GCC series inubuntu-toolchain-r/test, while the image intent is GCC 13 tooling and a stable runtime expectation. This madeensure_stdlibccbrittle and caused recurring failures when the PPA advanced.Apt pinning added before
dist-upgradepin_libstdcxxindocker/linux/ubuntu/fun.shand called it ininstall_baseafter repo setup/update and before package install/upgrade./etc/apt/preferences.d/99-libstdcxx-13to pin:libstdc++6libgcc-s1gcc-13-base(kept at13.*)13.*; when no13.*candidate exists, runtime pin format is derived from the current candidate major/version style to avoid hard failure.Stdlib verification kept diagnostic and less brittle
ensure_stdlibcc(expected + installed package line).Expected version default relaxed
docker/linux/ubuntu/Dockerfile:LIBSTDCXX_EXPECTED_VERSION=13.1→LIBSTDCXX_EXPECTED_VERSION=13.Example of the new pinning path:
Original prompt
Context
The Ubuntu build image's
install_basestep indocker/linux/ubuntu/fun.shadds theubuntu-toolchain-r/testPPA, then runsapt-get -qq dist-upgrade -y. That PPA ships the latestlibstdc++6(currently16-20260315-1ubuntu1~20~ppa1from gcc 16), sodist-upgradesilently upgradeslibstdc++6past the gcc-13 series we actually want.The trailing
ensure_stdlibcccheck then greps forLIBSTDCXX_EXPECTED_VERSION(currently13.1, with open PRs #518 / #519 trying to bump to13.3), which never matches and fails the build silently. The diagnostic-output change merged via PR #520 confirms the actually-installed version is now16-....Bumping the expected version is a treadmill — it will break again every time the PPA advances. The image is meant to ship gcc-13 + the matching libstdc++ runtime, so we should pin
libstdc++6to the gcc-13 series via apt preferences and stop lettingdist-upgradepull in newer libstdc++6 from the toolchain PPA.Task
Update
docker/linux/ubuntu/fun.shso that, beforeapt-get dist-upgrade -yruns ininstall_base, an apt-preferences pin is created that holdslibstdc++6(and friends — see notes) to the gcc-13 series from the toolchain PPA, preventing it from being upgraded to gcc-14/15/16 versions.Suggested approach:
After
add_apt_repos "${APT_REPOS_ENV[@]}"and the subsequentapt-get -qq update, write an apt preferences file that pins libstdc++6 to versions starting with13.. For example:Call
pin_libstdcxx_13before theapt_install "${DEV_PACKAGES[@]}"/apt-get -qq dist-upgrade -ylines ininstall_base.Notes:
Pin-Priority: 1001is required to allow downgrades if a newer version is somehow already installed. Priority>1000permits downgrades; ≤1000 only prevents upgrades.gcc-13-baseandlibgcc-s1to the same series is recommended because they ship together and are co-versioned withlibstdc++6. If onlylibstdc++6is pinned, dist-upgrade may produce conflicts.13.*does not behave as expected with this PPA's version strings (e.g.13.3.0-2ubuntu1~20.04), usePin: release o=LP-PPA-ubuntu-toolchain-r-testplusPin: version 13.*combined, or fall back toapt-mark holdafter explicitly installinglibstdc++6=13.*from the PPA. Pick whichever reliably yieldslibstdc++6at a13.*version afterdist-upgrade.After this change,
ensure_stdlibcc's grep forLIBSTDCXX_EXPECTED_VERSIONshould be updated to match whatever the gcc-13 series resolves to on the PPA at build time. A good default isLIBSTDCXX_EXPECTED_VERSION=13.(note the trailing dot) so any13.x.y-...version satisfies the check without the treadmill of bumping minors. Make this update whereverLIBSTDCXX_EXPECTED_VERSIONis currently set (search the repo for it — likely in a Dockerfile ARG/ENV).Do not remove the diagnostic output added in
ensure_stdlibccby PR fix(ensure_stdlibcc): surface installed libstdc++6 version in CI logs #520 — keep it so future regressions are easy to debug.Acceptance criteria
install_basesucceeds end-to-end on the currentubuntu-toolchain-r/testPPA state (where the latest libstdc++6 is from gcc 16).install_basecompletes,apt list --installed libstdc++6shows a13.*version (e.g.13.3.0-...), not14.*/15.*/16.*.ensure_stdlibccpasses (i.e. installedlibstdc++6matches the newLIBSTDCXX_EXPECTED_VERSION).docker/linux/ubuntu/fun.shand whichever file currently definesLIBSTDCXX_EXPECTED_VERSION(likely a Dockerfile underdocker/linux/ubuntu/). Do not change behaviour for non-Ubuntu images.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ```
(Reading database ... 12223 files and directories currently installed.)
#8 58.93 Preparing to unpack .../archives/apt_2.0.11_amd64.deb ...
#8 58.96 Unpacking apt (2.0.11) over (2.0.10) ...
#8 59.11 Setting up apt (2.0.11) ...
#8 59.38 Processing triggers for libc-bin (2.31-0ubuntu9.18) ...
#8 59.40 update-alternatives: using /usr/bin/gcc-13 to provide /usr/bin/gcc (gcc) in auto mode
#8 59.41
#8 59.41 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#8 59.41
#8 ERROR: process "/bin/bash -ec . ./ubuntu/fun.sh && install_base" did not complete successfully: exit code: 1
This pull request was created from Copilot chat.