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/link: cannot find runtime/cgo for c-archive, c-shared #54331

Closed
ii64 opened this issue Aug 8, 2022 · 2 comments
Closed

cmd/link: cannot find runtime/cgo for c-archive, c-shared #54331

ii64 opened this issue Aug 8, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@ii64
Copy link

ii64 commented Aug 8, 2022

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

$ go version
go version go1.19 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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ii64/.cache/go-build"
GOENV="/home/ii64/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ii64/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ii64/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="/usr/local/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/hh/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="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build475420545=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go build -buildmode=c-archive hh
go build -buildmode=c-shared hh

hh is a main package.

What did you expect to see?

Works just fine like -buildmode=plugin and -buildmode=exe

What did you see instead?

$ go build -buildmode=c-archive hh
# hh
loadinternal: cannot find runtime/cgo
@ii64 ii64 changed the title cmd/go: cannot find runtime/cgo for c-archive, c-shared cmd/link: cannot find runtime/cgo for c-archive, c-shared Aug 8, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 8, 2022
@cherrymui
Copy link
Member

cherrymui commented Aug 8, 2022

Does the build complete? This print is not an error and does not terminate the build. (See #31544)

Does your program not use cgo (import "C")? It is probably not very useful to build a program in c-archive or c-shared mode without using cgo, as it does not export any function to C code to call.

@cherrymui cherrymui added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 8, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
@ii64
Copy link
Author

ii64 commented Aug 21, 2022

Thank you, and yes I am not importing "C" and set CGO_ENABLED=0, it does not stop the build process. Closing this as it works as intended.

@ii64 ii64 closed this as completed Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Status: Done
Development

No branches or pull requests

4 participants