cli icon indicating copy to clipboard operation
cli copied to clipboard

Set CGO_ENABLED=1 on riscv64

Open Xeonacid opened this issue 1 year ago • 5 comments

- What I did

Set CGO_ENABLED=1 on riscv64 CGO works fine on riscv64 thus should be enabled. Avoid build error https://github.com/golang/go/issues/64875

- How I did it

Add riscv64 case in scripts/build/.variables

- How to verify it

Arch Linux PKGBUILD doesn't build on riscv64, as it uses -buildmode=pie and scripts/build/.variables sets CGO_ENABLED=0 before the PR. With this PR, it builds fine.

- Description for the changelog

Set CGO_ENABLED=1 on riscv64

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

Xeonacid avatar Mar 11 '24 06:03 Xeonacid

Codecov Report

Merging #4933 (800a51d) into master (d17b3b2) will decrease coverage by 0.01%. Report is 42 commits behind head on master. The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4933      +/-   ##
==========================================
- Coverage   61.42%   61.41%   -0.01%     
==========================================
  Files         289      289              
  Lines       20237    20237              
==========================================
- Hits        12431    12429       -2     
- Misses       6904     6905       +1     
- Partials      902      903       +1     

codecov-commenter avatar Mar 11 '24 13:03 codecov-commenter

Looks like it's segfaulting (possibly due to clang being used?)

#23 0.416 + go build -o /out/docker-linux-riscv64 -tags ' osusergo pkcs11' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=28ac7007e4" -X "github.com/docker/cli/cli/version.BuildTime=2024-03-11T11:38:31Z" -X "github.com/docker/cli/cli/version.Version=pr-4933" -extldflags -static' '-buildmode=pie' github.com/docker/cli/cmd/docker
#23 30.47 # github.com/docker/cli/cmd/docker
#23 30.47 /usr/local/go/pkg/tool/linux_amd64/link: running riscv64-alpine-linux-musl-clang failed: exit status 1
#23 30.47 clang-16: error: unable to execute command: Segmentation fault (core dumped)
#23 30.47 clang-16: error: linker command failed due to signal (use -v to see invocation)

thaJeztah avatar Mar 11 '24 13:03 thaJeztah

Looks like it's segfaulting (possibly due to clang being used?)

#23 0.416 + go build -o /out/docker-linux-riscv64 -tags ' osusergo pkcs11' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=28ac7007e4" -X "github.com/docker/cli/cli/version.BuildTime=2024-03-11T11:38:31Z" -X "github.com/docker/cli/cli/version.Version=pr-4933" -extldflags -static' '-buildmode=pie' github.com/docker/cli/cmd/docker
#23 30.47 # github.com/docker/cli/cmd/docker
#23 30.47 /usr/local/go/pkg/tool/linux_amd64/link: running riscv64-alpine-linux-musl-clang failed: exit status 1
#23 30.47 clang-16: error: unable to execute command: Segmentation fault (core dumped)
#23 30.47 clang-16: error: linker command failed due to signal (use -v to see invocation)

Weird... TBH I don't have much knowledge about alpine-linux-musl cross-compiler triplet. I tested on Arch Linux RISC-V with glibc, which works fine.

Xeonacid avatar Mar 11 '24 13:03 Xeonacid

Looks like it's segfaulting (possibly due to clang being used?)

#23 0.416 + go build -o /out/docker-linux-riscv64 -tags ' osusergo pkcs11' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=28ac7007e4" -X "github.com/docker/cli/cli/version.BuildTime=2024-03-11T11:38:31Z" -X "github.com/docker/cli/cli/version.Version=pr-4933" -extldflags -static' '-buildmode=pie' github.com/docker/cli/cmd/docker
#23 30.47 # github.com/docker/cli/cmd/docker
#23 30.47 /usr/local/go/pkg/tool/linux_amd64/link: running riscv64-alpine-linux-musl-clang failed: exit status 1
#23 30.47 clang-16: error: unable to execute command: Segmentation fault (core dumped)
#23 30.47 clang-16: error: linker command failed due to signal (use -v to see invocation)

https://github.com/docker/cli/pull/4937 should fix this issue

crazy-max avatar Mar 11 '24 13:03 crazy-max

Looks like it's segfaulting (possibly due to clang being used?)

#23 0.416 + go build -o /out/docker-linux-riscv64 -tags ' osusergo pkcs11' -ldflags ' -X "github.com/docker/cli/cli/version.GitCommit=28ac7007e4" -X "github.com/docker/cli/cli/version.BuildTime=2024-03-11T11:38:31Z" -X "github.com/docker/cli/cli/version.Version=pr-4933" -extldflags -static' '-buildmode=pie' github.com/docker/cli/cmd/docker
#23 30.47 # github.com/docker/cli/cmd/docker
#23 30.47 /usr/local/go/pkg/tool/linux_amd64/link: running riscv64-alpine-linux-musl-clang failed: exit status 1
#23 30.47 clang-16: error: unable to execute command: Segmentation fault (core dumped)
#23 30.47 clang-16: error: linker command failed due to signal (use -v to see invocation)

#4937 should fix this issue

Rebased. Could anyone approve the CI? Thanks!

Xeonacid avatar Mar 12 '24 15:03 Xeonacid