-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gha: add linux/arm/v5 to list of platforms #5388
base: master
Are you sure you want to change the base?
Conversation
Heh. Looks like alpine doesn't support v5 anymore?
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5388 +/- ##
=========================================
Coverage ? 59.74%
=========================================
Files ? 345
Lines ? 23430
Branches ? 0
=========================================
Hits ? 13999
Misses ? 8457
Partials ? 974 |
Dockerfile
Outdated
# gcc is installed for libgcc only | ||
RUN xx-apk add --no-cache musl-dev gcc | ||
RUN xx-apk add --no-cache musl-dev libgcc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting; this is causing failures on arm/v6 and arm/v7; it looks like we're explicitly disabling CGO (CGO_ENABLED=0
), but then try to compile with -buildmode=pie
- seems like something is off somewhere.
> [build-plugins 1/1] RUN --mount=ro --mount=type=cache,target=/root/.cache xx-go --wrap && TARGET=/out ./scripts/build/plugins e2e/cli-plugins/plugins/*:
0.127 Building static docker-helloworld
0.127 + CGO_ENABLED=0
0.127 + GO111MODULE=auto
0.127 + go build -o /out/plugins-linux-arm/docker-helloworld -tags ' osusergo' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=5c123b1" -X "github.com/docker/cli/cli/version.BuildTime=2024-09-02T13:52:17Z" -X "github.com/docker/cli/cli/version.Version=pr-5387" -extldflags -static' -buildmode=pie github.com/docker/cli/cli-plugins/examples/helloworld
0.135 -buildmode=pie requires external (cgo) linking, but cgo is not enabled
The -buildmode=pie
is probably set through GO_BUILDMODE
?
Lines 8 to 19 in b0c41b7
source ./scripts/build/.variables | |
for p in cli-plugins/examples/* "$@" ; do | |
[ -d "$p" ] || continue | |
n=$(basename "$p") | |
TARGET_PLUGIN="$(dirname "${TARGET}")/plugins-${GOOS}-${GOARCH}/docker-${n}" | |
mkdir -p "$(dirname "${TARGET_PLUGIN}")" | |
echo "Building $GO_LINKMODE $(basename "${TARGET_PLUGIN}")" | |
(set -x ; CGO_ENABLED=0 GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/${p}") | |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so the .variables
sets CGO_ENABLED=1
on arm;
Lines 57 to 68 in b0c41b7
if [ -z "$CGO_ENABLED" ]; then | |
case "$(go env GOOS)" in | |
linux) | |
case "$(go env GOARCH)" in | |
amd64|arm64|arm|s390x|riscv64) | |
CGO_ENABLED=1 | |
;; | |
*) | |
CGO_ENABLED=0 | |
;; | |
esac | |
;; |
And if enabled, it sets -buildmode=pie
;
Lines 79 to 88 in b0c41b7
if [ "$CGO_ENABLED" = "1" ] && [ "$(go env GOOS)" != "windows" ]; then | |
case "$(go env GOARCH)" in | |
mips*|ppc64) | |
# pie build mode is not supported on mips architectures | |
;; | |
*) | |
GO_BUILDMODE="-buildmode=pie" | |
;; | |
esac | |
fi |
So that looks to be conflicting with the hard-coded CGO_ENABLED=0
in this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly; doesn't fail on other PRs - wondering now what's causing that issue;
#18 [build-plugins 1/1] RUN --mount=ro --mount=type=cache,target=/root/.cache xx-go --wrap && TARGET=/out ./scripts/build/plugins e2e/cli-plugins/plugins/*
#18 0.126 Building static docker-helloworld
#18 0.126 + CGO_ENABLED=0
#18 0.126 + GO111MODULE=auto
#18 0.126 + go build -o /out/plugins-linux-arm/docker-helloworld -tags ' osusergo' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=0cebca4" -X "github.com/docker/cli/cli/version.BuildTime=2024-09-02T14:50:36Z" -X "github.com/docker/cli/cli/version.Version=pr-5389" -extldflags -static' -buildmode=pie github.com/docker/cli/cli-plugins/examples/helloworld
#18 19.75 # github.com/docker/cli/cli-plugins/examples/helloworld
#18 19.75 loadinternal: cannot find runtime/cgo
#18 19.85 Building static docker-badmeta
#18 19.85 + CGO_ENABLED=0
#18 19.85 + GO111MODULE=auto
scripts/build/plugins
Outdated
(set -x ; CGO_ENABLED=0 GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/${p}") | ||
(set -x ; CGO_ENABLED=0 GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" "github.com/docker/cli/${p}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, so this fixed the plugins being compiled, but looks like the binary itself does still require gcc
, not just libgcc
?
> [build 2/2] RUN --mount=type=bind,target=.,ro --mount=type=cache,target=/root/.cache --mount=type=tmpfs,target=cli/winresources xx-go --wrap && TARGET=/out ./scripts/build/binary && xx-verify $([ "static" = "static" ] && echo "--static") /out/docker:
0.113 + go build -o /out/docker-linux-arm-v6 -tags ' osusergo pkcs11' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=7e15277994" -X "github.com/docker/cli/cli/version.BuildTime=2024-09-02T14:39:44Z" -X "github.com/docker/cli/cli/version.Version=pr-5388" -extldflags -static' '-buildmode=pie' github.com/docker/cli/cmd/docker
29.74 # github.com/docker/cli/cmd/docker
29.74 /usr/local/go/pkg/tool/linux_amd64/link: running armv6-alpine-linux-musleabihf-clang failed: exit status 1
29.74 clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
29.74 ld.lld: error: cannot open crtbeginT.o: No such file or directory
29.74 ld.lld: error: unable to find library -lgcc
29.74 ld.lld: error: unable to find library -lgcc_eh
29.74 ld.lld: error: cannot open crtend.o: No such file or directory
29.74 clang: error: linker command failed with exit code 1 (use -v to see invocation)
We include this in the moby/moby repo, but it looks like we didn't for the CLI. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The comment describes we need gcc for libgcc only, so we may as well install that. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The `.variables` sets `CGO_ENABLED=1` on arm; https://github.com/docker/cli/blob/b0c41b78d8c80c5f8faa736cf3c74dc31092e443/scripts/build/.variables#L57-L68 And if enabled, it sets `-buildmode=pie`; https://github.com/docker/cli/blob/b0c41b78d8c80c5f8faa736cf3c74dc31092e443/scripts/build/.variables#L79-L88 But that looks to be conflicting with the hard-coded `CGO_ENABLED=0` in this script. > [build-plugins 1/1] RUN --mount=ro --mount=type=cache,target=/root/.cache xx-go --wrap && TARGET=/out ./scripts/build/plugins e2e/cli-plugins/plugins/*: 0.127 Building static docker-helloworld 0.127 + CGO_ENABLED=0 0.127 + GO111MODULE=auto 0.127 + go build -o /out/plugins-linux-arm/docker-helloworld -tags ' osusergo' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=5c123b1" -X "github.com/docker/cli/cli/version.BuildTime=2024-09-02T13:52:17Z" -X "github.com/docker/cli/cli/version.Version=pr-5387" -extldflags -static' -buildmode=pie github.com/docker/cli/cli-plugins/examples/helloworld 0.135 -buildmode=pie requires external (cgo) linking, but cgo is not enabled Remove `GO_BUILDMODE` from this script so that we don't try to build with `-buildmode=pie`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This reverts commit df2a797. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
07d689f
to
a829217
Compare
We include this in the moby/moby repo, but it looks like we didn't for the CLI.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)