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

Cross compilation macos -> linux doesn't work #25

Closed
bobrik opened this issue Feb 16, 2018 · 1 comment
Closed

Cross compilation macos -> linux doesn't work #25

bobrik opened this issue Feb 16, 2018 · 1 comment

Comments

@bobrik
Copy link

bobrik commented Feb 16, 2018

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

$ go version
go version go1.9.4 darwin/amd64

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

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/bobrik/cf-repos/els"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.4/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.4/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/xv/lkn605ns2c7fy9vtkz49dhcr0000gn/T/go-build106115125=/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?

$ GOOS=linux go install -v github.com/DataDog/zstd

What did you expect to see?

Succesful compilation with no errors

What did you see instead?

github.com/DataDog/zstd
go build github.com/DataDog/zstd: build constraints exclude all Go files in /tmp/dd/src/github.com/DataDog/zstd

It works just fine if I compile on linux directly or on macos directly, but not with cross-compilation.

@Viq111
Copy link
Collaborator

Viq111 commented Feb 16, 2018

Hi @bobrik
This library is actually a cgo wrapper over the official C library so you will need to have a linux C toolchain installed on your build environment.

I haven't done any cgo cross-compilation myself but a quick google search yields https://github.com/karalabe/xgo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants