fix(build): set CGO_ENABLED=0 in Makefile to produce static gcluster binary - #6259
fix(build): set CGO_ENABLED=0 in Makefile to produce static gcluster binary#6259Neelabh94 wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a runtime failure in the gcluster binary on older Linux distributions caused by dynamic linking against newer GLIBC versions. By forcing a static build, the change ensures portability across various environments and aligns the Makefile build process with the existing CI validation logic. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Description
The official
gclusterLinux amd64 release binary (v1.102.0) fails on Debian 11 (Bullseye) due to missing GLIBC symbols:Root Cause
golang:1.26-trixie(Debian 13 Trixie, which has GLIBC 2.40+).linux/amd64on alinux/amd64builder host, Go defaults toCGO_ENABLED=1, dynamically linkinggclusteragainst the builder's glibc (Debian Trixie) and embedding requirements forGLIBC_2.32andGLIBC_2.34. Debian 11 ships with GLIBC 2.31..github/workflows/os-support-validation.ymlexplicitly builds withCGO_ENABLED=0 go build -o gcluster ., which is why PR CI passed ondebian:11-slimwhile release binaries were dynamically linked.Solution
Explicitly set
CGO_ENABLED=0in theMakefilefor thegclustertarget. This ensures that:make(including Cloud Build release pipelines and local builds) are fully static ELF executables with zero GLIBC dependencies.Testing
make gclusterproduces a statically linked ELF executable (file gcluster)../gcluster --versioninside a cleandebian:11container.CGO_ENABLED=0 go test ./cmd/... ./pkg/....