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

Go command looks for runtime/cgo with CGO_ENABLED=0 #52816

Closed
luxifer opened this issue May 10, 2022 · 3 comments
Closed

Go command looks for runtime/cgo with CGO_ENABLED=0 #52816

luxifer opened this issue May 10, 2022 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@luxifer
Copy link

luxifer commented May 10, 2022

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

$ go version
go version go1.18.1 linux/amd64

Does this issue reproduce with the latest release?

I'm using the latest release.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/build/.cache"
GOENV="/home/fviel/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/build/pkg/mod"
GONOPROXY=""
GONOSUMDB="redacted"
GOOS="linux"
GOPATH="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/build"
GOPRIVATE=""
GOPROXY="redacted,https://proxy.golang.org,direct"
GOROOT="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/go-tmp"
GOTOOLDIR="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="x86_64-poky-linux-gcc-ar"
CC="x86_64-poky-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysro
ot=/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot"
CXX="x86_64-poky-linux-g++  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysr
oot=/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot"
CGO_ENABLED="0"
GOMOD="/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/build/src/sentryo.net/backend/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/fviel/poky/build/tmp/work
/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot -I . -fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/home/fviel/poky/build/tmp/work/core2-64-poky-linux/bac
kend/0.1+gitAUTOINC+f03090758d-r0/go-tmp/go-build683272935=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm compiling go inside yocto, using the default go-mod.bbclass. I added the CGO_ENABLED=0 env var to produce statically linked binary.

When running CGO_ENABLED=0 go build from my dev VM it works, not inside yocto.

What did you expect to see?

Nothing, it should produce a statically linked binary.

What did you see instead?

I'm seeing this error:

cannot find package runtime/cgo (using -importcfg)
/home/fviel/poky/build/tmp/work/core2-64-poky-linux/backend/0.1+gitAUTOINC+f03090758d-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux/go/pkg/tool/linux_amd64/link: cannot open file : open : no such file or directory
@seankhliao
Copy link
Member

What's the full command being run?
What's the full output?
How do we reproduce this?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 10, 2022
@luxifer
Copy link
Author

luxifer commented May 10, 2022

The command being run:

x86_64-poky-linux-go build  -p 16 -v  -modcacherw -a -tags ''

There is no other interesting output and our code does not rely on C.

I will try to provide reproducible steps. It's using yocto so it's not just one command.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 5, 2022
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants