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

cmd/compile: github.com/opencontainers/runc for riscv64 build error #58861

Closed
zhangze0722 opened this issue Mar 4, 2023 · 7 comments
Closed
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@zhangze0722
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
go version go1.20 linux/amd64

What did you do?

cross-compile runc for riscv64:

zhangze@zhangze-virtual-machine:~/source/runc$ GOARCH=riscv64 make
go build -x -v -p 1 -work -trimpath "-buildmode=pie" -tags "seccomp urfave_cli_no_docs" -ldflags "-X main.gitCommit=v1.1.0-415-g58c192a1-dirty -X main.version=1.1.0+dev " -o runc . &> ok_riscv.txt
make: *** [Makefile:61: runc] Error 1

What did you expect to see?

get runc binary for riscv64

What did you see instead?

use single thread compile, when build stop get here, no error

........
cd /home/zhangze/source/runc
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b216/pkg.a -trimpath "/usr/local/go/src/os/signal=>os/signal;$WORK/b216=>" -p os/signal -std -installsuffix shared -buildid S3IUt_jZSvoWGaSdfmtY/S3IUt_jZSvoWGaSdfmtY -goversion go1.20 -symabis $WORK/b216/symabis -shared -c=16 -nolocalimports -importcfg $WORK/b216/importcfg -pack -asmhdr $WORK/b216/go_asm.h /usr/local/go/src/os/signal/doc.go /usr/local/go/src/os/signal/signal.go /usr/local/go/src/os/signal/signal_unix.go
cd /usr/local/go/src/os/signal
/usr/local/go/pkg/tool/linux_amd64/asm -p os/signal -trimpath "/usr/local/go/src/os/signal=>os/signal;$WORK/b216=>" -I $WORK/b216/ -I /usr/local/go/pkg/include -D GOOS_linux -D GOARCH_riscv64 -shared -o $WORK/b216/sig.o ./sig.s
/usr/local/go/pkg/tool/linux_amd64/pack r $WORK/b216/pkg.a $WORK/b216/sig.o # internal
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b216/pkg.a # internal
cp $WORK/b216/pkg.a /home/zhangze/.cache/go-build/58/582849006a0f4de5257286dfde3db9c85b50af607c3eabdd279820266e8b2c87-d # internal

because make enable seccomp by default, so cgo for riscv is needed, I heared riscv64 CGO support has been upstream, yes?

At least go build should give some error output.

=======================
if build in yocto for riscv:
https://github.com/riscv/meta-riscv
enable seccomp tag, result is the same as previous one.
disable seccomp tag, so no cgo will be used, then build is OK.

@seankhliao seankhliao changed the title github.com/opencontainers/runc for riscv64 build error cmd/compile: github.com/opencontainers/runc for riscv64 build error Mar 4, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 4, 2023
@seankhliao seankhliao added arch-riscv Issues solely affecting the riscv64 architecture. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Mar 4, 2023
@seankhliao
Copy link
Member

cc @golang/riscv64

@mengzhuo
Copy link
Contributor

mengzhuo commented Mar 5, 2023

It seems cross-compile issue, I can build and run runc on linux riscv64 box without problem.

@zhangze0722
Copy link
Author

It seems cross-compile issue, I can build and run runc on linux riscv64 box without problem.

which version runc and go?

I use go version 1.19 on qemuriscv64, also failed.

@mengzhuo
Copy link
Contributor

mengzhuo commented Mar 5, 2023

It seems cross-compile issue, I can build and run runc on linux riscv64 box without problem.

which version runc and go?

I use go version 1.19 on qemuriscv64, also failed.

On my visionfive2(Engineering Release 69, linux 5.15) go1.20.
runc.gz

@zhangze0722
Copy link
Author

yes, qemuriscv64 can build runc with libseccomp.so successfully, it's cross-compile bug.

@mengzhuo
Copy link
Contributor

mengzhuo commented Mar 7, 2023

I'm closing this issue for now.
If you this is still an issue, please reopen it.

@mengzhuo mengzhuo closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2023
@zhangze0722
Copy link
Author

enable debug:
export GODEBUG = " cgocheck=2"

| go build github.com/seccomp/libseccomp-golang:
| # pkg-config --cflags -- libseccomp
| pkg-config: exec: "pkg-config": executable file not found in $PATH

so add the following will resolve this issue:
DEPENDS = "pkgconfig-native"

thanks a lot, no problem

@golang golang locked and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants