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

[Bug Report] Unable to compile trace/trace.go for arm64 #453

Closed
3 tasks done
douglarek opened this issue Feb 2, 2024 · 10 comments · Fixed by daeuniverse/dae_bpf_headers#2 or #487
Closed
3 tasks done

[Bug Report] Unable to compile trace/trace.go for arm64 #453

douglarek opened this issue Feb 2, 2024 · 10 comments · Fixed by daeuniverse/dae_bpf_headers#2 or #487

Comments

@douglarek
Copy link
Contributor

Checks

  • I have searched the existing issues
  • I have read the documentation
  • Is it your first time sumbitting an issue

Current Behavior

#435 The implemented dae trace functionality seems unable to achieve cross-platform compilation. For example, it cannot compile packages for the arm64 architecture on amd64, and even fails to compile arm64 packages on arm64.

I found that the arm64 package compiled in GitHub Actions also encounters errors when compiling trace/trace.go, but it is simply skipped.

Expected Behavior

Is this the intended behavior? However, according to the instructions in #435, it should support the arm64 architecture.

Steps to Reproduce

GOARCH=arm64 make

Environment

  • Dae version (use dae --version): the latest main branch
  • OS (e.g cat /etc/os-release): x86_64 linux
  • Kernel (e.g. uname -a): 6.7.2
  • Others:

Anything else?

No response

@dae-prow
Copy link
Contributor

dae-prow bot commented Feb 2, 2024

Thanks for opening this issue!

@hero-intelligent
Copy link
Contributor

Same issue here, failed to build. I'm on amd64 machine!

root@debian:/dae# make OUTPUT=dae GOFLAGS="-buildvcs=false" CC=clang CGO_ENABLED=0
-no-strip
Compiled /dae/control/bpf_bpfel.o
Wrote /dae/control/bpf_bpfel.go
Compiled /dae/control/bpf_bpfeb.o
Wrote /dae/control/bpf_bpfeb.go
Supported targets:
        bpf
        bpfel
        bpfeb
        386
        amd64
        arm
        arm64
        arm64be
        armbe
        ppc64
        ppc64le
        riscv64
        s390
        s390x
        sparc
        sparc64

Error: "": unsupported target
exit status 1
trace/trace.go:26: running "go": exit status 1
-DMAX_MATCH_SET_LEN=64 -O2 -Wall -Werror
go build -tags= -o dae -trimpath -ldflags "-s -w -X github.com/daeuniverse/dae/cmd.Version=unstable-20240202.r662.a85abb4 -X github.com/daeuniverse/dae/common/consts.MaxMatchSetLen_=64"  .

@jschwinger233
Copy link
Member

@hero-intelligent it looks more like a successful build to me. Can you check your local file, I think there is a dae binary.

@jschwinger233
Copy link
Member

@douglarek What error did you see when building on arm64?

@douglarek
Copy link
Contributor Author

douglarek commented Feb 4, 2024

@douglarek What error did you see when building on arm64?

https://github.com/daeuniverse/dae/actions/runs/7768012231/job/21185471106#step:8:181 The issue here is not whether we can build the DAE binary; the issue is that we cannot compile trace/trace.go on arm64

@douglarek douglarek changed the title [Bug Report] Unable to compile the dae trace package for arm64 [Bug Report] Unable to compile trace/trace.go for arm64 Feb 4, 2024
@jschwinger233
Copy link
Member

@douglarek Got it. This is because arm64 requires vmlinux-arm.h. I'll create a PR for it. Also will make #435 (comment) happen.

@hero-intelligent
Copy link
Contributor

@hero-intelligent it looks more like a successful build to me. Can you check your local file, I think there is a dae binary.

I forgot to check if there is a dae binary, but I noticed the difference of the output of previous commit, the commit right before dae trace:

root@debian:/dae# git reset e04b16fdea70f38f8e3dd6637a8bb38739cd8baa --hard
HEAD is now at e04b16f ci(release): draft release v0.5.1 (#441)
root@debian:/dae# make OUTPUT=dae GOFLAGS="-buildvcs=false" CC=clang CGO_ENABLED=0
git submodule update --init --recursive -- control/kern/headers && \
touch control/kern/headers
Submodule path 'control/kern/headers': checked out 'd72c67ed8f5a7d11774b5cd88734e2ffe6847721'
-no-strip
go: downloading github.com/cilium/ebpf v0.11.0
go: downloading golang.org/x/sys v0.11.0
Compiled /dae/control/bpf_bpfel.o
Wrote /dae/control/bpf_bpfel.go
Compiled /dae/control/bpf_bpfeb.o
Wrote /dae/control/bpf_bpfeb.go
-DMAX_MATCH_SET_LEN=64 -O2 -Wall -Werror
go build -o dae -trimpath -ldflags "-s -w -X github.com/daeuniverse/dae/cmd.Version=unstable-20240124.r659.e04b16f -X github.com/daeuniverse/dae/common/consts.MaxMatchSetLen_=64"  .

@jschwinger233
Copy link
Member

@hero-intelligent If you want to build dae with trace module, you have to specify GOARCH=amd64 in command line (for now. will opt-out this hassle soon). Even if you don't, dae compiles as well, just without trace module.

@hero-intelligent
Copy link
Contributor

hero-intelligent commented Feb 4, 2024

@hero-intelligent If you want to build dae with trace module, you have to specify GOARCH=amd64 in command line (for now. will opt-out this hassle soon). Even if you don't, dae compiles as well, just without trace module.

OK, I see. I'll modify the Dockerfile, for that's the best tutorial and the most convenient way for most of people to approach.

@hero-intelligent
Copy link
Contributor

My problem may be easily solved without modifying Dockerfile. 5b4f9e0 This early commit has deleted GOARCH variable for some reason, and somehow didn't come back until now.

hero-intelligent added a commit to hero-intelligent/dae that referenced this issue Feb 4, 2024
ci(Makefile): add back `GOARCH ?=$(shell go env GOARCH)` to enable trace module by default daeuniverse#453 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants