We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
CGO_ENABLED=1
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 version go1.24.1 linux/arm64
go env
AR='ar' CC='gcc' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='g++' GCCGO='gccgo' GO111MODULE='on' GOARCH='arm64' GOARM64='v8.0' GOAUTH='netrc' GOBIN='' GOCACHE='/home/ulin/.cache/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/home/ulin/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFIPS140='off' GOFLAGS='' GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1300834282=/tmp/go-build -gno-record-gcc-switches' GOHOSTARCH='arm64' GOHOSTOS='linux' GOINSECURE='' GOMOD='/mnt/data/lean/g/excersize/go.mod' GOMODCACHE='/home/ulin/gosrc/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/ulin/gosrc' GOPRIVATE='' GOPROXY='https://goproxy.cn' GOROOT='/usr/local/go' GOSUMDB='off' GOTELEMETRY='on' GOTELEMETRYDIR='/home/ulin/.config/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64' GOVCS='' GOVERSION='go1.24.1' GOWORK='' PKG_CONFIG='pkg-config'
cross compiling a tiny cgo program for riscv64.
package main /* #include <stdio.h> #include <stdlib.h> // A C function void myprint() { printf("env: PATH=%s\n", getenv("PATH")); } */ import "C" func main() { C.myprint() }
CC=/usr/bin/riscv64-linux-gnu-gcc GOARCH=riscv64 go build m.go
go: no Go source files
As the default CGO_ENABLED=1 showed in go env, the build should succeed. But need to explicitly set CGO_ENABLED=1 in the build command.
FYI, go build complained "no Go source files" doesn't convey any useful information for one to figure out what's going wrong.
go build
The text was updated successfully, but these errors were encountered:
I wonder if this can be covered by #48540?
Sorry, something went wrong.
No branches or pull requests
Go version
go version go1.24.1 linux/arm64
Output of
go env
in your module/workspace:What did you do?
cross compiling a tiny cgo program for riscv64.
CC=/usr/bin/riscv64-linux-gnu-gcc GOARCH=riscv64 go build m.go
What did you see happen?
go: no Go source files
What did you expect to see?
As the default CGO_ENABLED=1 showed in
go env
, the build should succeed.But need to explicitly set CGO_ENABLED=1 in the build command.
FYI,
go build
complained "no Go source files" doesn't convey any useful information for one to figure out what's going wrong.The text was updated successfully, but these errors were encountered: