-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scripts/build/binary: disable pkcs11 on static builds with CGO_ENABLED=1 #3494
Draft
thaJeztah
wants to merge
1
commit into
docker:master
Choose a base branch
from
thaJeztah:fix_pkcs11_static
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #3494 +/- ##
=======================================
Coverage 58.99% 59.00%
=======================================
Files 282 284 +2
Lines 23836 23839 +3
=======================================
+ Hits 14062 14066 +4
Misses 8914 8914
+ Partials 860 859 -1 |
thaJeztah
force-pushed
the
fix_pkcs11_static
branch
from
March 28, 2022 15:22
a32d77b
to
11bc888
Compare
pkcs11 cannot be compiled statically if CGO is enabled (and glibc is used) see https://github.com/docker/cli/blob/3897c3fa544f1239c2bc2c3af2adcebcb3650c4d/vendor/github.com/miekg/pkcs11/pkcs11.go#L75 see docker#3490 (comment) When trying to do otherwise, warnings are printed (and shouldn't be ignored, similar to the `osusergo` build-tag): docker#32 [linux/amd64->s390x build 2/2] RUN --mount=type=bind,target=.,ro --mount=type=cache,target=/root/.cache --mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk --mount=type=tmpfs,target=cli/winresources xx-go --wrap && TARGET=/out ./scripts/build/binary && xx-verify $([ "static" = "static" ] && echo "--static") /out/docker docker#32 467.0 # github.com/docker/cli/cmd/docker docker#32 467.0 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-900380651/000018.o: in function `New': docker#32 467.0 /go/src/github.com/docker/cli/vendor/github.com/miekg/pkcs11/pkcs11.go:75: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking docker#32 467.0 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-900380651/000004.o: in function `_cgo_26061493d47f_C2func_getaddrinfo': docker#32 467.0 /tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah
force-pushed
the
fix_pkcs11_static
branch
from
April 1, 2022 20:31
11bc888
to
df4531a
Compare
Still need to look into this one. Reproduction steps; docker run -it --rm golang:1.19.5-bullseye
go env CGO_ENABLED
1
git clone https://github.com/docker/cli /go/src/github.com/docker/cli
cd /go/src/github.com/docker/cli
git checkout v23.0.0
DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary Notice the warnings in the output; ./scripts/build/binary
Building static docker-linux-arm64
+ go build -o build/docker-linux-arm64 -tags osusergo pkcs11 -ldflags -X "github.com/docker/cli/cli/version.GitCommit=e92dd87c32" -X "github.com/docker/cli/cli/version.BuildTime=2023-02-06T10:53:47Z" -X "github.com/docker/cli/cli/version.Version=23.0.0" -extldflags -static -buildmode=pie github.com/docker/cli/cmd/docker
# github.com/docker/cli/cmd/docker
/usr/bin/ld: /tmp/go-link-1909522509/000020.o: in function `New':
/go/src/github.com/docker/cli/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /tmp/go-link-1909522509/000004.o: in function `_cgo_2ac87069779a_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking Note that the binary is statically linked though;
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pkcs11 cannot be compiled statically if CGO is enabled (and glibc is used)
see
cli/vendor/github.com/miekg/pkcs11/pkcs11.go
Line 75 in 3897c3f
see #3490 (comment)
When trying to do otherwise, warnings are printed (and shouldn't be ignored,
similar to the
osusergo
build-tag):Signed-off-by: Sebastiaan van Stijn [email protected]
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)