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

loadinternal: cannot find runtime/cgo #39321

Closed
jiftle opened this issue May 30, 2020 · 4 comments
Closed

loadinternal: cannot find runtime/cgo #39321

jiftle opened this issue May 30, 2020 · 4 comments

Comments

@jiftle
Copy link

@jiftle jiftle commented May 30, 2020

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

$ go version
go version go1.14.3 windows/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
D:\checktool>go env
set GO111MODULE=on
set GOARCH=386
set GOBIN=
set GOCACHE=C:\Users\john\AppData\Local\go-build
set GOENV=C:\Users\john\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\john\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set GO386=sse2
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=D:\checktool\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m32 -fmessage-length=0 -fdebug-prefix-map=C:\Users\john\AppData\
Local\Temp\go-build468324490=/tmp/go-build -gno-record-gcc-switches

What did you do?

What did you expect to see?

I want to build go to 32bit dll, but is error.

# e.coding.net/jiftle/inwarehousetool/checktool
loadinternal: cannot find runtime/cgo

set GOARCH=amd64 is ok.

What did you see instead?

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented May 30, 2020

Try setting CGO_ENABLED=1. It seems you are cross-compiling from amd64 to 386 (GOHOSTARCH=amd64, GOARCH=386). Cgo is by default disabled with cross-compilation. You need to enable it explicitly.

@jiftle
Copy link
Author

@jiftle jiftle commented May 30, 2020

Try setting CGO_ENABLED=1. It seems you are cross-compiling from amd64 to 386 (GOHOSTARCH=amd64, GOARCH=386). Cgo is by default disabled with cross-compilation. You need to enable it explicitly.

My Question is ok , thank you. --by china developer

@jiftle jiftle closed this May 30, 2020
@Co0nan
Copy link

@Co0nan Co0nan commented Jul 26, 2020

set CGO_ENABLED=1 didn't solve this issue for me ? does this error means cgo not installed ?

C:\Users\user\Desktop\dll>go build -buildmode=c-archive
# _/C_/Users/user/Desktop/dll
loadinternal: cannot find runtime/cgo

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 26, 2020

@Co0nan This issue is closed. I suggest that you ask your question on a forum. See https://golang.org/wiki/Questions. You will need to provide additional information, like Go version number, operating system, and where your Go installation came from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.