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/go: cross compile failed without useful error message #22952

Closed
mingrammer opened this issue Dec 1, 2017 · 3 comments
Closed

cmd/go: cross compile failed without useful error message #22952

mingrammer opened this issue Dec 1, 2017 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@mingrammer
Copy link
Contributor

mingrammer commented Dec 1, 2017

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

go version go1.9.2 darwin/amd64

Does this issue reproduce with the latest release?

I'm using latest version

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ming/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mm/33b_7wg94g73p0l7w8m11dvw0000gn/T/go-build649463343=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

I've ran GOOS=linux GOARCH=amd64 go build -v -o appname on macOS Sierra

What did you expect to see?

Successful linux cross compilation

What did you see instead?

The cross compile have been failed without any useful error messages. Just return the error code 2. But there are no any problems with go build -v -o appname.

How can I debug it?

@bradfitz
Copy link
Contributor

bradfitz commented Dec 1, 2017

I can't reproduce on macOS Sierra.

Try adding -x to go build and post the results.

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 1, 2017
@bradfitz bradfitz changed the title Cross compile has been failed without useful error messages cmd/go: cross compile failed without useful error message Dec 1, 2017
@mingrammer
Copy link
Contributor Author

mingrammer commented Dec 1, 2017

@bradfitz Thanks for letting me know -x option.

There is a clear error message as follow:

...
mkdir -p $WORK/github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/
cd /Users/ming/go/src/github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/go-sqlite3
/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64/compile -o $WORK/github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/go-sqlite3.a -trimpath $WORK -goversion go1.9.2 -p github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/go-sqlite3 -complete -buildid e2e40ec7a2518c0ee6542b117325619e76d5295c -importmap golang.org/x/net/context=github.com/sundaytoz/sql-snippet-manager/vendor/golang.org/x/net/context -D _/Users/ming/go/src/github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/go-sqlite3 -I $WORK -I /Users/ming/go/pkg/darwin_amd64 -pack ./doc.go ./sqlite3_go18.go
# github.com/sundaytoz/sql-snippet-manager/vendor/github.com/mattn/go-sqlite3
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:18:10: undefined: SQLiteConn
...

Sorry for that I did not check carefully. Yes I got an error, this is not a problem of build command.

Thanks :)

@qianguozheng
Copy link

@mingrammer have you fix the cross compilation of go-sqlite3 ?
I encounter this problem too, but can not fix it

@golang golang locked and limited conversation to collaborators Jul 6, 2019
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

4 participants