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: no Go source files 1.20 #59787

Closed
cruvie opened this issue Apr 23, 2023 · 2 comments
Closed

go: no Go source files 1.20 #59787

cruvie opened this issue Apr 23, 2023 · 2 comments

Comments

@cruvie
Copy link

cruvie commented Apr 23, 2023

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

$ go version
go version go1.20 darwin/arm64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN="/usr/local/go/bin"
GOCACHE="/Users/xhkang/Library/Caches/go-build"
GOENV="/Users/xhkang/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/xhkang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xhkang/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xhkang/KangXH/Coding/Uncomplete-Projects/image2heic_go/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s2/4jkt9rnj46s4mv5s32b2wf5c0000gn/T/go-build1811831719=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I want to build a c-shared lib
when I use go build -buildmode=c-shared -o libdartinterface.so dart_interface.go it works fine.
when I use GOOS=linux GOARCH=arm64 go build -buildmode=c-shared -o libdartinterface.so dart_interface.go it says go: no Go source files .
But the two action is in the same directory

iShot_2023-04-23_23 44 09

What did you expect to see?

generate c-shared lib file with cmd GOOS=linux GOARCH=arm64 go build -buildmode=c-shared -o libdartinterface.so dart_interface.go

What did you see instead?

go: no Go source files

@seankhliao
Copy link
Member

you need to explicitly enable cgo when cross compiling

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2023
@cruvie
Copy link
Author

cruvie commented Apr 24, 2023

you need to explicitly enable cgo when cross compiling

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

Thank you , I got it , but I still think the error prompt should be more specific

@golang golang locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants