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

Set CGO_ENABLED=1 on riscv64 #4933

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Conversation

Xeonacid
Copy link
Contributor

- What I did

Set CGO_ENABLED=1 on riscv64
CGO works fine on riscv64 thus should be enabled.
Avoid build error golang/go#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

@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2024

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     

@thaJeztah
Copy link
Member

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)

@Xeonacid
Copy link
Contributor Author

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.

@crazy-max
Copy link
Member

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

CGO works fine on riscv64 thus should be enabled.
Avoid build error golang/go#64875

Signed-off-by: Zhuo Zhi <h.dwwwwww@gmail.com>
@Xeonacid
Copy link
Contributor Author

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!

Copy link
Member

@Benehiko Benehiko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit b4d0328 into docker:master Mar 25, 2024
88 checks passed
@vvoland vvoland modified the milestones: 27.0.0, 26.1.0 Apr 10, 2024
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.

None yet

6 participants