From cb0e56ff035f79aa7a64a3ef3aafe9d622bba7dd Mon Sep 17 00:00:00 2001 From: Cory Snider Date: Thu, 29 Aug 2024 16:50:52 -0400 Subject: [PATCH] hack/make/.binary: set CCGO_CFLAGS=-Wno-atomic-alignment for arm/v5 cross-compiling for arm/v5 fails on go1.22; a fix is included for this in go1.23 (https://github.com/golang/go/issues/65290), but for go1.22 we can set the correct option manually. 1.189 + go build -mod=vendor -modfile=vendor.mod -o /tmp/bundles/binary-daemon/dockerd -tags 'netgo osusergo static_build journald' -ldflags '-w -X "github.com/docker/docker/dockerversion.Version=dev" -X "github.com/docker/docker/dockerversion.GitCommit=HEAD" -X "github.com/docker/docker/dockerversion.BuildTime=2024-08-29T16:59:57.000000000+00:00" -X "github.com/docker/docker/dockerversion.PlatformName=" -X "github.com/docker/docker/dockerversion.ProductName=" -X "github.com/docker/docker/dockerversion.DefaultProductLicense=" -extldflags -static ' -gcflags= github.com/docker/docker/cmd/dockerd 67.78 # runtime/cgo 67.78 gcc_libinit.c:44:8: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] 67.78 gcc_libinit.c:47:6: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] 67.78 gcc_libinit.c:49:10: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] 67.78 gcc_libinit.c:69:9: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] 67.78 gcc_libinit.c:71:3: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] 78.20 + rm -f /go/src/github.com/docker/docker/go.mod Co-authored-by: Sebastiaan van Stijn Signed-off-by: Cory Snider (cherry picked from commit e853c093bf8b9b614b187d4571588f30e08d605d) Signed-off-by: Cory Snider --- hack/make/.binary | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hack/make/.binary b/hack/make/.binary index 3812468209..d1dbccc51b 100644 --- a/hack/make/.binary +++ b/hack/make/.binary @@ -74,6 +74,14 @@ source "${MAKEDIR}/.go-autogen" fi fi + if [ "$(go env GOARCH)" = "arm" ] && [ "$(go env GOARM)" = "5" ]; then + # cross-compiling for arm/v5 fails on go1.22; a fix is included for this + # in go1.23 (https://github.com/golang/go/issues/65290), but for go1.22 + # we can set the correct option manually. + CGO_CFLAGS+=" -Wno-atomic-alignment" + export CGO_CFLAGS + fi + echo "Building $([ "$DOCKER_STATIC" = "1" ] && echo "static" || echo "dynamic") $DEST/$BINARY_FULLNAME ($PLATFORM_NAME)..." if [ -n "$DOCKER_DEBUG" ]; then set -x