Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: provide better error message when cross-compiling toolchain is required #16395
510fb63: tip between 1.7rc1 and 1.7rc2
This also causes
Maybe this is expected (?), but it doesn't seem right to me.
You are trying to cross-compile from darwin/amd64 to android/amd64, but you seem to be using the native compiler rather than a cross-compiler. That can't work.
Note that for android/amd64 the default build mode is -pie which means that cmd/link will always invoke the external linker, so you always need to provide a cross-compiler.
changed the title
cmd/go: cannot link android/amd64 on darwin/amd64: ld: unknown option: -z
Jul 17, 2016
That test is invalid. On Exherbo, all compilation takes the cross-compilation path, including both compiling for the host architecture and multilib.
All four are supported and in active use on Exherbo.
Ah, was brought here by a google search for a similar error to that which the OP hit. Is there a ticket for that?
My specific case is I noticed (while building 1.7.1 release as an upgrade from 1.6.3) that cgo.a was not being built. This resulted in another package failing to build due to it being missing, similar to what this issue describes (1.6.3 had worked fine)
referenced this issue
Dec 3, 2016
Re @ianlancetaylor's comment above:
The second half is likely true. The first half is not necessarily true. If it succeeds maybe your system simply knows how to run cross-compiled binaries. For example building 32-bit binaries on a 64-bit system, or even arm binaries on an x86 system if you have a binfmt module installed to run qemu or some such.
I do agree with Minux that instead of running ./trivial we can open it and inspect the header and sanity check against the target GOOS/GOARCH. If someone wants to send a CL for that (not during a release freeze), that'd be great.