Skip to content

fix: statically link libstdc++/libgcc so releases run on Ubuntu 20.04#283

Open
blondfrogs wants to merge 1 commit into
masterfrom
fix/ubuntu-20-libstdcxx
Open

fix: statically link libstdc++/libgcc so releases run on Ubuntu 20.04#283
blondfrogs wants to merge 1 commit into
masterfrom
fix/ubuntu-20-libstdcxx

Conversation

@blondfrogs
Copy link
Copy Markdown
Member

CI builds inside ubuntu:20.04 but installs gcc-11 from the ubuntu-toolchain-r/test PPA for C++20 support, which brings a newer libstdc++.so.6 into the build environment. The resulting fluxd dynamic-links against it and fails at runtime on stock Ubuntu 20.04 with "GLIBCXX_3.4.29 not found" / "CXXABI_1.3.13 not found".

  • zcutil/build.sh: pass -static-libstdc++ -static-libgcc via LDFLAGS so the C++ runtime is baked into the binary, decoupling it from the build host's libstdc++ version.

  • depends/packages/zeromq.mk: strip -lstdc++ from libzmq.pc Libs.private. pkg-config injects this into the link line, and an explicit -lstdc++ overrides -static-libstdc++ (which only affects gcc's implicit libstdc++ link). Removing it lets static-libstdc++ take effect.

Verified end-to-end by rebuilding the same source in a fresh ubuntu:20.04 container with these patches: ldd shows no libstdc++.so.6 dependency, max GLIBC required is 2.30, and the binary runs cleanly on stock ubuntu:20.04. No CI workflow changes needed.

CI builds inside ubuntu:20.04 but installs gcc-11 from the
ubuntu-toolchain-r/test PPA for C++20 support, which brings a newer
libstdc++.so.6 into the build environment. The resulting fluxd
dynamic-links against it and fails at runtime on stock Ubuntu 20.04
with "GLIBCXX_3.4.29 not found" / "CXXABI_1.3.13 not found".

- zcutil/build.sh: pass -static-libstdc++ -static-libgcc via LDFLAGS so
  the C++ runtime is baked into the binary, decoupling it from the
  build host's libstdc++ version.

- depends/packages/zeromq.mk: strip -lstdc++ from libzmq.pc Libs.private.
  pkg-config injects this into the link line, and an explicit -lstdc++
  overrides -static-libstdc++ (which only affects gcc's implicit
  libstdc++ link). Removing it lets static-libstdc++ take effect.

Verified end-to-end by rebuilding the same source in a fresh ubuntu:20.04
container with these patches: ldd shows no libstdc++.so.6 dependency,
max GLIBC required is 2.30, and the binary runs cleanly on stock
ubuntu:20.04. No CI workflow changes needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant