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

GOARCH=arm64 go generate is failing on x86_64 #1046

Open
SRodi opened this issue Nov 20, 2024 · 1 comment · May be fixed by #1050
Open

GOARCH=arm64 go generate is failing on x86_64 #1046

SRodi opened this issue Nov 20, 2024 · 1 comment · May be fixed by #1050
Labels
lang/go The Go Programming Language meta/invalid This doesn't seem right

Comments

@SRodi
Copy link
Member

SRodi commented Nov 20, 2024

Issue

go generate for GOARCH=arm64 is failing

❯ GOARCH=arm64 go generate ./pkg/plugin/...;                            
fork/exec /tmp/go-build4230987009/b001/exe/mockgen: exec format error
pkg/plugin/api/types.go:13: running "go": exit status 1
fork/exec /tmp/go-build1479343241/b001/exe/mockgen: exec format error
pkg/plugin/common/common_linux.go:20: running "go": exit status 1
fork/exec /tmp/go-build3235587832/b001/exe/bpf2go: exec format error
pkg/plugin/conntrack/conntrack_linux.go:22: running "go": exit status 1
fork/exec /tmp/go-build7630523/b001/exe/bpf2go: exec format error
pkg/plugin/dropreason/dropreason_linux.go:36: running "go": exit status 1
fork/exec /tmp/go-build2414488603/b001/exe/bpf2go: exec format error
pkg/plugin/filter/filter_map_linux.go:23: running "go": exit status 1
fork/exec /tmp/go-build1515059695/b001/exe/mockgen: exec format error
pkg/plugin/infiniband/types_linux.go:17: running "go": exit status 1
fork/exec /tmp/go-build2004312046/b001/exe/mockgen: exec format error
pkg/plugin/linuxutil/types_linux.go:16: running "go": exit status 1
fork/exec /tmp/go-build396399719/b001/exe/bpf2go: exec format error
pkg/plugin/packetforward/packetforward_linux.go:31: running "go": exit status 1
fork/exec /tmp/go-build309799770/b001/exe/bpf2go: exec format error
pkg/plugin/packetparser/packetparser_linux.go:52: running "go": exit status 1

Environment

❯ uname -a                 
Linux Simone 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

❯ go version                                      
go version go1.23.1 linux/amd64

❯ which clang
which llvm-strip
/usr/bin/clang
/usr/bin/llvm-strip
@timraymond
Copy link
Member

Spoke with @SRodi offline about this. My working theory on the root cause of this is the re-entrant invocation of the Go toolchain with go generate. When GOARCH=arm64 go generate ./pkg/plugin/... happens, it invokes the go run github.com/x/y/z/bpf2go@master lines. This also receives GOARCH=arm64, and builds the arm64 version of bpf2go. It then tries to run it and fails because it's an amd64 system.

I don't think go generate was ever intended to be used with go run embedded in it. I think the solution will be to remove the go run parts. A workaround could be to go install the tools ahead of time.

github-merge-queue bot pushed a commit that referenced this issue Nov 20, 2024
# Description

- Adding files that where not generated for PR #926  due to issue #1046
- I generated those from an arm64 VM

## Related Issue

If this pull request is related to any issue, please mention it here.
Additionally, make sure that the issue is assigned to you before
submitting this pull request.

## Checklist

- [x] I have read the [contributing
documentation](https://retina.sh/docs/contributing).
- [x] I signed and signed-off the commits (`git commit -S -s ...`). See
[this
documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
on signing commits.
- [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.

## Screenshots (if applicable) or Testing Completed

- run `make test` prior this change and there where failures.
- run `make test` post change and no failures 

## Additional Notes

Add any additional notes or context about the pull request here.

---

Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more
information on how to contribute to this project.
@timraymond timraymond linked a pull request Nov 21, 2024 that will close this issue
@SRodi SRodi added meta/invalid This doesn't seem right lang/go The Go Programming Language labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/go The Go Programming Language meta/invalid This doesn't seem right
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants