On Wed, Feb 15, 2017 at 4:35 AM, Joseph Lorenzini <[email protected]> wrote:
>
> I am writing and building my code on a mac. The code is a linux binary
> though so its obviously a cross compilation. This works fine:
>
> GOOS=linux GOARCH=amd64  go build .
>
> This does not:
>
> GOOS=linux GOARCH=amd64  go build -race .
> go build: -race requires cgo; enable cgo by setting CGO_ENABLED=1
>
> Nor does this:
>
>  GOOS=linux GOARCH=amd64  CGO_ENABLED=1 go build -race .
> # runtime/cgo
> ld: unknown option: --build-id=none
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)

The race detector depends on a module written in C++, and requires the
C++ linker to do the final link.  In order to do what you want, you
will need a Darwin -> GNU/Linux C++ cross-compiler.  You can get one
by building GCC or clang in the appropriate way.  When you have that,
set the CC and CXX environment variables to point to your
cross-compiler.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to