Skip to content
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

update go to 1.17 #3383

Merged
merged 1 commit into from
Mar 26, 2022
Merged

update go to 1.17 #3383

merged 1 commit into from
Mar 26, 2022

Conversation

thaJeztah
Copy link
Member

carries / closes #3258

Removes the platform based switch between different versions.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Comment on lines 9 to 15
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx

FROM go-${TARGETOS} AS build-base-alpine
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} AS build-base-alpine
COPY --from=xx / /
RUN apk add --no-cache bash clang lld llvm file git
WORKDIR /go/src/github.com/docker/cli
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at these stages, and it appears we're not using the alpine stages anywhere? (perhaps I overlooked though 🤔)

@thaJeztah
Copy link
Member Author

Looks like this is failing;

#18 https://github.com/theupdateframework/notary/releases/download/v0.6.1/notary-Linux-amd64
#18 ERROR: invalid response status 503

@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2021

Codecov Report

Merging #3383 (a2692d3) into master (0b266ba) will decrease coverage by 0.00%.
The diff coverage is n/a.

❗ Current head a2692d3 differs from pull request most recent head 6119e4b. Consider uploading reports for the commit 6119e4b to get more accurate results

@@            Coverage Diff             @@
##           master    #3383      +/-   ##
==========================================
- Coverage   59.01%   59.00%   -0.01%     
==========================================
  Files         284      282       -2     
  Lines       23833    23830       -3     
==========================================
- Hits        14066    14062       -4     
  Misses       8908     8908              
- Partials      859      860       +1     

@thaJeztah
Copy link
Member Author

okay; this looks ✅ now

@crazy-max @silvin-lubecki PTAL (please double check if I didn't miss something in the Dockerfile changes)

@crazy-max
Copy link
Member

crazy-max commented Dec 9, 2021

@thaJeztah Needs to fix buster target too otherwise:

$ make -f docker.Makefile dynbinary
...
#5 [internal] load metadata for docker.io/library/go-linux:latest
#5 ERROR: pull access denied, repository does not exist or may require authorization: authorization status: 401: authorization failed
------
 > [internal] load metadata for docker.io/library/go-linux:latest:
------
Dockerfile:21
--------------------
  19 |     RUN xx-apk add --no-cache musl-dev gcc
  20 |
  21 | >>> FROM go-${TARGETOS} AS build-base-buster
  22 |     COPY --from=xx / /
  23 |     RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld file

Replace

cli/Dockerfile

Line 32 in 548fd20

FROM go-${TARGETOS} AS build-base-buster

With

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} AS build-base-buster

We should add a step in the build matrix to cover that. Can be done in follow-up.

Edit: PR opened #3384

@thaJeztah
Copy link
Member Author

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} AS build-base-buster

Actually looking now if we need to use BASE_VARIANT in that one, as that would make the alpine and buster ones the same. (We probably do need it to pick the right base though).

Also; guess we should be updating to bullseye now

@thaJeztah thaJeztah changed the title update go to 1.17 update go to 1.17, debian bullseye Dec 9, 2021
@crazy-max
Copy link
Member

@thaJeztah libgcc-8-dev > libgcc-10-dev or libgcc-*-dev.

@thaJeztah
Copy link
Member Author

🤦 thought I could just a quick find/replace. Of course I could expect that 😅

@thaJeztah
Copy link
Member Author

Hmmm... this looks like something we need to fix; are we missing the osusergo build-tag? (or do we need to compile without cgo here?) see golang/go#23265

#53 [linux/amd64 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
#53 953.6 # github.com/docker/cli/cmd/docker
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000022.o: in function `New':
#53 953.6 /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
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000018.o: in function `mygetgrouplist':
#53 953.6 /usr/local/go/src/os/user/getgrouplist_unix.go:18: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000017.o: in function `mygetgrgid_r':
#53 953.6 /usr/local/go/src/os/user/cgo_lookup_unix.go:40: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000017.o: in function `mygetgrnam_r':
#53 953.6 /usr/local/go/src/os/user/cgo_lookup_unix.go:45: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000017.o: in function `mygetpwnam_r':
#53 953.6 /usr/local/go/src/os/user/cgo_lookup_unix.go:35: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000017.o: in function `mygetpwuid_r':
#53 953.6 /usr/local/go/src/os/user/cgo_lookup_unix.go:30: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
#53 953.6 /usr/bin/s390x-linux-gnu-ld: /tmp/go-link-2402600021/000004.o: in function `_cgo_3c1cec0c9a4e_C2func_getaddrinfo':
#53 953.6 /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

@thaJeztah
Copy link
Member Author

Actual failure is in this bit though;

 > [linux/amd64 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:
#69 946.2 ld.lld: error: allocatestack.c:429:(.text+0x183C): unknown relocation (313) against symbol __default_pthread_attr_lock
#69 946.2 ld.lld: error: allocatestack.c:528:(.text+0x185C): unknown relocation (313) against symbol __static_tls_align_m1
#69 946.2 ld.lld: error: allocatestack.c:538:(.text+0x1898): unknown relocation (313) against symbol __static_tls_size
#69 946.2 ld.lld: error: allocatestack.c:525:(.text+0x18B4): unknown relocation (313) against symbol _dl_stack_flags
#69 946.2 ld.lld: error: pthread_create.c:875:(.text+0x1B7C): unknown relocation (313) against symbol __stack_chk_guard
#69 946.2 ld.lld: error: allocatestack.c:447:(.text+0x1BC8): unknown relocation (313) against symbol __static_tls_size
#69 946.2 ld.lld: error: allocatestack.c:457:(.text+0x1BDC): unknown relocation (313) against symbol __static_tls_align_m1
#69 946.2 ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
#69 946.2 clang: error: linker command failed with exit code 1 (use -v to see invocation)
#69 946.2 

@thaJeztah
Copy link
Member Author

Looks like my last commit fixed the osusergo issue, but this one is still remaining;

#57 [linux/amd64->arm64 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
#57 434.9 # github.com/docker/cli/cmd/docker
#57 434.9 /usr/local/go/pkg/tool/linux_amd64/link: running aarch64-linux-gnu-clang failed: exit status 1
#57 434.9 ld.lld: error: allocatestack.c:962:(.text+0x80C): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: allocatestack.c:1051:(.text+0x974): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: allocatestack.c:1067:(.text+0x9D8): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: allocatestack.c:1077:(.text+0xA60): unknown relocation (313) against symbol __xidcmd
#57 434.9 ld.lld: error: pthread_create.c:256:(.text+0x121C): unknown relocation (313) against symbol __pthread_keys
#57 434.9 ld.lld: error: pthread_create.c:379:(.text+0x13A4): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: pthread_create.c:483:(.text+0x1450): unknown relocation (313) against symbol __call_tls_dtors
#57 434.9 ld.lld: error: pthread_create.c:625:(.text+0x1728): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: pthread_create.c:634:(.text+0x1764): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: pthread_create.c:635:(.text+0x177C): unknown relocation (313) against symbol __default_pthread_attr
#57 434.9 ld.lld: error: pthread_create.c:655:(.text+0x17E4): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: allocatestack.c:427:(.text+0x181C): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: allocatestack.c:428:(.text+0x1834): unknown relocation (313) against symbol __default_pthread_attr
#57 434.9 ld.lld: error: allocatestack.c:429:(.text+0x183C): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: allocatestack.c:528:(.text+0x185C): unknown relocation (313) against symbol __static_tls_align_m1
#57 434.9 ld.lld: error: allocatestack.c:538:(.text+0x1898): unknown relocation (313) against symbol __static_tls_size
#57 434.9 ld.lld: error: allocatestack.c:525:(.text+0x18B4): unknown relocation (313) against symbol _dl_stack_flags
#57 434.9 ld.lld: error: pthread_create.c:875:(.text+0x1B7C): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: allocatestack.c:447:(.text+0x1BC8): unknown relocation (313) against symbol __static_tls_size
#57 434.9 ld.lld: error: allocatestack.c:457:(.text+0x1BDC): unknown relocation (313) against symbol __static_tls_align_m1
#57 434.9 ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
#57 434.9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
#57 434.9 
#57 ERROR: process "/bin/sh -c xx-go --wrap &&     TARGET=/out ./scripts/build/binary &&     xx-verify $([ \"$GO_LINKMODE\" = \"static\" ] && echo \"--static\") /out/docker" did not complete successfully: exit code: 2
 [linux/amd64->arm64 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:
#57 434.9 ld.lld: error: allocatestack.c:429:(.text+0x183C): unknown relocation (313) against symbol __default_pthread_attr_lock
#57 434.9 ld.lld: error: allocatestack.c:528:(.text+0x185C): unknown relocation (313) against symbol __static_tls_align_m1
#57 434.9 ld.lld: error: allocatestack.c:538:(.text+0x1898): unknown relocation (313) against symbol __static_tls_size
#57 434.9 ld.lld: error: allocatestack.c:525:(.text+0x18B4): unknown relocation (313) against symbol _dl_stack_flags
#57 434.9 ld.lld: error: pthread_create.c:875:(.text+0x1B7C): unknown relocation (313) against symbol __stack_chk_guard
#57 434.9 ld.lld: error: allocatestack.c:447:(.text+0x1BC8): unknown relocation (313) against symbol __static_tls_size
#57 434.9 ld.lld: error: allocatestack.c:457:(.text+0x1BDC): unknown relocation (313) against symbol __static_tls_align_m1
#57 434.9 ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
#57 434.9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
#57 434.9 

Removes the platform based switch between different versions.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title update go to 1.17, debian bullseye update go to 1.17, ~debian bullseye~ Mar 26, 2022
@thaJeztah thaJeztah changed the title update go to 1.17, ~debian bullseye~ update go to 1.17 Mar 26, 2022
@thaJeztah
Copy link
Member Author

I removed the update to debian bullseye from this PR, and the other fixes (osusergo, updating xx have been moved separate and are merged; gonna move the bullseye update separate so that we can look how to fix that.

After this is merged, I'll also look at using gofmt for go1.17 (and probably update to go1.18); small steps..

@thaJeztah
Copy link
Member Author

Let's get this one in; I'll open a PR for the debian update, and will have a look at updating gofmt, and go1.18

@thaJeztah thaJeztah merged commit e1d4324 into docker:master Mar 26, 2022
@thaJeztah thaJeztah deleted the bump_go_117 branch March 26, 2022 17:06
@thaJeztah
Copy link
Member Author

opened #3493 for the debian step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants