go: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found
What version of Go are you using (go version
)?
$ go version go version go1.20 darwin/arm64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/andig/Library/Caches/go-build" GOENV="/Users/andig/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/andig/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/andig/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.20" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/andig/htdocs/evcc/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build3562167146=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.20 darwin/arm64 GOROOT/bin/go tool compile -V: compile version go1.20 uname -v: Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 ProductName: macOS ProductVersion: 13.1 BuildVersion: 22C65 lldb --version: lldb-1400.0.38.17 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
What did you do?
After upgrading our build environment and go.mod
requirement to Go 1.20, users started to see this error message on Ubuntu: https://github.com/evcc-io/evcc/issues/6263. The application does not use CGO.
What did you expect to see?
No error. Same build was working fine with Go ^1.18.
What did you see instead?
GLIBC version required. This output of go version -m
should be similar to what the build produces for arm:
build -buildmode=exe
build -compiler=gc
build -ldflags="-X github.com/evcc-io/evcc/server.Version=0.109.2 -X github.com/evcc-io/evcc/server.Commit=3ec2d1b70 -s -w"
build -tags=release
build CGO_ENABLED=0
build GOARCH=arm
build GOOS=linux
build GOARM=6
build vcs=git
build vcs.revision=3ec2d1b70abf2a5a827e43755f5e94df59eb1add
build vcs.time=2022-12-19T13:08:03Z
build vcs.modified=true
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 16 (9 by maintainers)
Commits related to this issue
- fix /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found https://github.com/golang/go/issues/58550 — committed to masahide/gopssh by masahide a year ago
- Fix Building of Static Binaries With Go 1.20 Explicitly disable CGO when building binaries. As of Go 1.20, we get dynamic executables when using standard libary packages that have both cgo and pure ... — committed to cwarden/force by cwarden a year ago
- Avoiding glibc error on older Linux New Go version causes different linking behaviour in produced executable. On older Linux machines the following error occured: ``` dpcmder: /lib64/libc.so.6: versi... — committed to croz-ltd/dpcmder by vvidovic-croz a year ago
- Set GO_ENABLED=0 in go-install-tool When Golang is 1.20 and hosted OS in CI is Ubuntu-22.04, then we need to set CGO_ENABLED to zero, https://github.com/golang/go/issues/58550, for the controller-gen... — committed to razo7/self-node-remediation by razo7 a year ago
- Set CGO_ENABLED=0 in go-install-tool When Golang is 1.20 and hosted OS in CI is Ubuntu-22.04, then we need to set CGO_ENABLED to zero, https://github.com/golang/go/issues/58550, for the controller-ge... — committed to razo7/self-node-remediation by razo7 a year ago
- Disable cgo As part of the Go 1.20 release it seems like the default for `CGO_ENABLED` is no longer carried over from the tools. This leads to linking issues on systems that use different versions of... — committed to deverton-godaddy/netreap by deverton-godaddy a year ago
- Refactor endpoint handling and reconcilliation (#21) * Disable cgo As part of the Go 1.20 release it seems like the default for `CGO_ENABLED` is no longer carried over from the tools. This leads t... — committed to cosmonic/netreap by deverton-godaddy a year ago
- Fix issue with GLIBC_2.32 not found in release binaries Fix by disabling CGO_ENABLED See: https://github.com/golang/go/issues/58550 — committed to michal-kopczynski/kubectl-curl by michal-kopczynski 8 months ago
- fix: fixes #311 - disable cgo in release builds We were getting the following error on el7: $ ./versitygw -h ./versitygw: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./versitygw) ./... — committed to versity/versitygw by benmcclelland 7 months ago
see #57328
here is my case may help others Stackoverflow
Thank you both.
I’ve re-run the golang-releaser build with 1.19 and it ends up with
CGO_ENABLED=1
, too. With 1.19 that doesn’t hurt apparently, with 1.20 it does. I’m not a compiler person and totally fail to make the connection from the Go release notes to the problem observed. I do understand that dynamic linking requires the link targets to be available at runtime. What I don’t get is what has changed between 1.19 and 1.20 that makes it behave differently with regards to runtime behaviour.Happy to not get an answer, solved by forcing the build to
CGO_ENABLED=0
which I suspected to be the default all the time. I could imagine though that the change in behaviour will confuse other devs, too.@Pim-Infuzed This issue is closed. If you are having trouble I suggest that you ask on a forum, with full details about what you are doing. See https://go.dev/wiki/Questions. Thanks.
if you build your code in docker for arm, with
arm64v8/golang:1.20
image. There is a change that upgrade the base OS frombullseye
tobookworm
. So the version of glibc was changed.CGO_ENABLED=1
is the default and always has been. It’s true that in 1.19 if you built the tools withCGO_ENABLED=0
, then the tools would in turn default to building programs withCGO_ENABLED=0
. I believe that that is no longer true in 1.20.I have
CGO_ENABLED
unset in the build environment. It’s confusing that the build would end withCGO_ENABLED=1
? Seems this wasn’t the case with Go 1.19.Looking at the evcc issue, it’s your nightly ubuntu builds. These are linked against glibc.
As we no longer ship precompiled archives for the standard library, it’s up to you to ensure glibc linking (if you use it, eg using
net
) works. https://go.dev/doc/go1.20#go-commandClosing as working as intended.