René's URL Explorer Experiment


Title: slim and alpine images record CXX=gcc since 3.14.6, breaking C++ extension builds (no libstdc++ link) · Issue #1131 · docker-library/python · GitHub

Open Graph Title: slim and alpine images record CXX=gcc since 3.14.6, breaking C++ extension builds (no libstdc++ link) · Issue #1131 · docker-library/python

X Title: slim and alpine images record CXX=gcc since 3.14.6, breaking C++ extension builds (no libstdc++ link) · Issue #1131 · docker-library/python

Description: Summary Since 3.14.6, the slim and alpine images record CXX=gcc and LDCXXSHARED="gcc -shared" in _sysconfigdata. setuptools links C++ extension modules with LDCXXSHARED, and gcc does not link libstdc++, so every C++ extension built from ...

Open Graph Description: Summary Since 3.14.6, the slim and alpine images record CXX=gcc and LDCXXSHARED="gcc -shared" in _sysconfigdata. setuptools links C++ extension modules with LDCXXSHARED, and gcc does not link libst...

X Description: Summary Since 3.14.6, the slim and alpine images record CXX=gcc and LDCXXSHARED="gcc -shared" in _sysconfigdata. setuptools links C++ extension modules with LDCXXSHARED, and gcc does not ...

Opengraph URL: https://github.com/docker-library/python/issues/1131

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"slim and alpine images record CXX=gcc since 3.14.6, breaking C++ extension builds (no libstdc++ link)","articleBody":"## Summary\n\nSince **3.14.6**, the `slim` and `alpine` images record `CXX=gcc` and `LDCXXSHARED=\"gcc -shared\"` in `_sysconfigdata`. setuptools links C++ extension modules with `LDCXXSHARED`, and `gcc` does not link libstdc++, so **every C++ extension built from an sdist inside these images produces a `.so` with no `DT_NEEDED` on `libstdc++.so.6`** and fails at import with an undefined C++ symbol.\n\nThis happens even when the user has installed `g++` themselves, because the wrong value is baked into `_sysconfigdata` at image build time.\n\n## Affected images\n\n```\n$ docker run --rm python:X python -c \"import sysconfig; print(sysconfig.get_config_var('CXX'), '|', sysconfig.get_config_var('LDCXXSHARED'))\"\n```\n\n| image | `CXX` | `LDCXXSHARED` | |\n|---|---|---|---|\n| `python:3.14.5` | `g++` | `g++ -shared` | ok |\n| `python:3.14.5-slim` | `g++` | `g++ -shared` | ok |\n| `python:3.14.5-alpine` | `g++` | `g++ -shared` | ok |\n| `python:3.13.15-slim` | `g++` | `g++ -shared` | ok |\n| `python:3.14.7` | `/usr/bin/g++` | `/usr/bin/g++ -shared` | ok |\n| `python:3.14.6-slim` | **`gcc`** | **`gcc -shared`** | **broken** |\n| `python:3.14.7-slim` | **`gcc`** | **`gcc -shared`** | **broken** |\n| `python:3.14.7-alpine` | **`gcc`** | **`gcc -shared -Wl,-z,stack-size=1048576`** | **broken** |\n\n3.14.3 and 3.14.4 are also fine; the change appears in 3.14.6. Reproduced on both `linux/amd64` and `linux/arm64`.\n\n## Reproduction\n\n`repro.sh`:\n\n```bash\nset -e\napt-get update -qq >/dev/null 2>&1\napt-get install -y -qq --no-install-recommends build-essential >/dev/null 2>&1\npip install -q setuptools >/dev/null 2>&1\nmkdir -p /t && cd /t\n\ncat > ext.cpp \u003c\u003c'CPP'\n#include \u003cPython.h>\n#include \u003cstdexcept>\nstatic PyObject* f(PyObject*, PyObject*) {\n  try { throw std::runtime_error(\"boom\"); }\n  catch (const std::exception& e) { return PyUnicode_FromString(e.what()); }\n}\nstatic PyMethodDef M[] = {{\"f\", f, METH_NOARGS, \"\"},{NULL,NULL,0,NULL}};\nstatic struct PyModuleDef mod = {PyModuleDef_HEAD_INIT, \"ext\", NULL, -1, M};\nPyMODINIT_FUNC PyInit_ext(void){ return PyModule_Create(&mod); }\nCPP\n\ncat > setup.py \u003c\u003c'PY'\nfrom setuptools import setup, Extension\nsetup(name=\"ext\", ext_modules=[Extension(\"ext\", [\"ext.cpp\"], language=\"c++\")],\n      script_args=[\"build_ext\", \"--inplace\"])\nPY\n\npython setup.py >/dev/null 2>&1\necho -n \"  DT_NEEDED libstdc++: \"; grep -aq \"libstdc++.so.6\" ext*.so && echo YES || echo NO\necho -n \"  import: \"; python -c \"import ext; print('OK ->', ext.f())\" 2>&1 | tail -1\n```\n\nRun it in both images:\n\n```bash\nfor v in 3.14.5 3.14.7; do\n  echo \"== python:$v-slim ==\"\n  docker run --rm -v \"$PWD/repro.sh:/x.sh\" \"python:$v-slim\" bash /x.sh\ndone\n```\n\nResult — note that `build-essential`, which provides `g++`, is installed in **both** cases:\n\n```\n== python:3.14.5-slim ==\n  DT_NEEDED libstdc++: YES\n  import: OK -> boom\n== python:3.14.7-slim ==\n  DT_NEEDED libstdc++: NO\n  import: ImportError: /t/ext.cpython-314-x86_64-linux-gnu.so: undefined symbol: _ZNSt13runtime_errorD1Ev\n```\n\n## Real-world impact\n\nAny project that compiles a C++ extension from an sdist. In our case `cartopy`, which publishes no wheels and so is always compiled:\n\n```\nImportError: /app/.venv/lib/python3.14/site-packages/cartopy/trace.cpython-314-x86_64-linux-gnu.so:\nundefined symbol: _ZTINSt8ios_base7failureB5cxx11E\n```\n\nThis can stay hidden for a long time: with Docker layer caching the extension is only recompiled when an earlier layer changes, so an image keeps building successfully on a cached `.so` and then breaks on the first unrelated cache bust.\n\n## Likely cause\n\n`3.14/slim-trixie/Dockerfile` and `3.14/alpine*/Dockerfile` list `gcc` in their build dependencies but not `g++`, whereas `3.14/trixie/Dockerfile` inherits `g++` from `buildpack-deps:trixie`. That matches the table exactly: the two variants without `g++` at CPython build time are the two that are broken, and the full image is fine.\n\nThat has presumably always been true of the slim/alpine dependency lists, so the trigger looks like a change in how CPython's `configure` handles a missing `g++` between 3.14.5 and 3.14.6. 3.14.5 recorded the bare name `g++` regardless, which then resolved fine once the user installed it; 3.14.6+ appears to resolve it at configure time and fall back to `$CC` when it is absent. Consistent with that, the full image now records the absolute `/usr/bin/g++` where 3.14.5 recorded the bare `g++`.\n\n## Suggested fix\n\nAdd `g++` to the build dependencies for the `slim` and `alpine` variants so `configure` records a real C++ compiler. It is removed again with the rest of the build deps, so the runtime image size should be unaffected.\n\n## Workaround\n\nOverride the values in the build stage:\n\n```dockerfile\nENV CXX=\"g++\" LDCXXSHARED=\"g++ -shared\"\n```\n","author":{"url":"https://github.com/vtoupet","@type":"Person","name":"vtoupet"},"datePublished":"2026-08-28T09:06:28Z","url":"https://github.com/docker-library/python/issues/1131"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e9e13058-df22-6d09-311d-486fe6277fee
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8C1E:DDED5:11206A4:1781465:6AFEA1D1
html-safe-nonceef299e6b567312f7f00b064d0358862d64979ebecd67956b79e98a4ce26ee008
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzFFOkRERUQ1OjExMjA2QTQ6MTc4MTQ2NTo2QUZFQTFEMSIsInZpc2l0b3JfaWQiOiIzMTMyOTQ1NTU2MzUxOTE4NTQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac38b2d40eb3818f2c8f21a7f20fbbc4633f236ed948fd868376e3c78b388eae95
hovercard-subject-tagissue:5276623177
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/docker-library/python/1131/issue_layout
twitter:imagehttps://opengraph.githubassets.com/657aade9d41d972febed01104e0a23b04bfedfd15c24c60fb24efbf8b8ab860c/docker-library/python/issues/1131
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/657aade9d41d972febed01104e0a23b04bfedfd15c24c60fb24efbf8b8ab860c/docker-library/python/issues/1131
og:image:altSummary Since 3.14.6, the slim and alpine images record CXX=gcc and LDCXXSHARED="gcc -shared" in _sysconfigdata. setuptools links C++ extension modules with LDCXXSHARED, and gcc does not link libst...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevtoupet
hostnamegithub.com
expected-hostnamegithub.com
None95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e
turbo-cache-controlno-preview
go-importgithub.com/docker-library/python git https://github.com/docker-library/python.git
octolytics-dimension-user_id7739233
octolytics-dimension-user_logindocker-library
octolytics-dimension-repository_id21054928
octolytics-dimension-repository_nwodocker-library/python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id21054928
octolytics-dimension-repository_network_root_nwodocker-library/python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3f25273206cd841171bca0002261ae4c9757d934
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/docker-library/python/issues/1131#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdocker-library%2Fpython%2Fissues%2F1131
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdocker-library%2Fpython%2Fissues%2F1131
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=docker-library%2Fpython
Reloadhttps://github.com/docker-library/python/issues/1131
Reloadhttps://github.com/docker-library/python/issues/1131
Reloadhttps://github.com/docker-library/python/issues/1131
docker-libraryhttps://github.com/docker-library
pythonhttps://github.com/docker-library/python
Codehttps://github.com/docker-library/python
Issues23 (23)https://github.com/docker-library/python/issues
Pull requests5 (5)https://github.com/docker-library/python/pulls
Discussionshttps://github.com/docker-library/python/discussions
Actionshttps://github.com/docker-library/python/actions
Projectshttps://github.com/docker-library/python/projects
Security and qualityhttps://github.com/docker-library/python/security
Insightshttps://github.com/docker-library/python/insights
https://github.com/docker-library/python
New issuehttps://github.com/login?return_to=https://github.com/docker-library/python/issues/1131
New issuehttps://github.com/login?return_to=https://github.com/docker-library/python/issues/1131
#1132https://github.com/docker-library/python/pull/1132
slim and alpine images record CXX=gcc since 3.14.6, breaking C++ extension builds (no libstdc++ link)https://github.com/docker-library/python/issues/1131#top
#1132https://github.com/docker-library/python/pull/1132
https://github.com/vtoupet
vtoupethttps://github.com/vtoupet
on Aug 28, 2026https://github.com/docker-library/python/issues/1131#issue-5276623177
https://github.com/yosifkit
yosifkithttps://github.com/yosifkit
on Aug 28, 2026https://github.com/docker-library/python/issues/1131#issuecomment-5455730501
python/cpython#150211https://github.com/python/cpython/pull/150211
tianonhttps://github.com/tianon
completedhttps://github.com/docker-library/python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#1132https://github.com/docker-library/python/pull/1132
on Aug 31, 2026https://github.com/docker-library/python/issues/1131#event-30299030432
Sign up for freehttps://github.com/signup?return_to=https://github.com/docker-library/python/issues/1131
Sign in to commenthttps://github.com/login?return_to=https://github.com/docker-library/python/issues/1131
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.