Skip to content

compiling on different architectures #30089

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

Closed
mdt711 opened this issue Feb 5, 2019 · 2 comments
Closed

compiling on different architectures #30089

mdt711 opened this issue Feb 5, 2019 · 2 comments

Comments

@mdt711
Copy link

mdt711 commented Feb 5, 2019

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

There are actually 2 involved:

$ go version
go version go1.11.5 linux/arm
$ go version
go version go1.11.5 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env on arm Output
$ go env
GOARCH="arm"
GOBIN=""
GOCACHE="/home/md711/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mdt711/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build715063890=/tmp/go-build -gno-record-gcc-switches"
go env on amd Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mdt711/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mdt711/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build854378217=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Compiling and Running
https://play.golang.com/p/qdTmNmeX51O

What did you expect to see?

The code should print a slice with one element in it:

$ go run foo.go
[0xc000070960]

and it does that, if I compile it on linux/amd64.

What did you see instead?

If compiled on linux/arm (or windows/amd64 or freebsd/amd64) the output is:

$ go run foo.go
[]

Note: It depends on where I compile the code. Cross compiling on linux/amd64 to any of the mentioned targets works perfectly fine. While cross compiling on any target except linux/amd64 to any other target doesn't work.

@AlexRouSg
Copy link
Contributor

You are using different versions of the package on each machine.

The slice only has one element in it when using hash 3c7a5c1c36469ca783f92a078616fd74be13f01f or older.

@mdt711
Copy link
Author

mdt711 commented Feb 5, 2019

facepalm indeed. thank you :)

@mdt711 mdt711 closed this as completed Feb 5, 2019
@golang golang locked and limited conversation to collaborators Feb 5, 2020
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