Golang cross compile undefined errors

Viewed 1025

Probably something obvious, I'm building on OSX trying to build a Linux binary, this same command works on another project but:

GOOS=darwin GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor

returns without error

GOOS=linux GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor
gitlab.com/project/project-data-convertor
# gitlab.com/project/project-data-convertor
./utils.go:253:50: undefined: beamLocation
./utils.go:278:36: undefined: beamLocation
./utils.go:278:50: undefined: beamLocations
./utils.go:278:50: too many errors
1 Answers

I know it's a bit too late to answer this question but this problem came, on my side, from the import of C module. For those who have this problem of cross-platform compilation, check that you don't import C module : normally it should work.

Related