go: enable MIPS GOARCH/cross integration

This allows the Go compiler in nixpkgs (eg. buildGoModule) to work with
crossSystem.config == mips-*, eg mips-unknown-linux-musl, and
succesfully generate Go MIPS binaries.

nix-build -A grpcurl --arg crossSystem '{ config = "mips-unknown-linux-musl"; }'

This unfortunately cannot currently be tested on qemu-mips as Go emits
ELF files that fail to execute correctly in qemu-user (see:
https://go-review.googlesource.com/c/go/+/239217, on track to land in Go
1.17). However, I have tested this on a physical MIPS device.

I have not been able to build anything using cgo (hit various
compilation errors in C dependencies), but considering
mips-unknown-linux-musl is not a support nixpkgs target this isn't that
surprising.
This commit is contained in:
Serge Bazanski 2021-07-20 23:39:32 +02:00
parent 8472d44b82
commit c00d507f97
3 changed files with 3 additions and 0 deletions

View file

@ -41,6 +41,7 @@ let
"armv6l" = "arm";
"armv7l" = "arm";
"powerpc64le" = "ppc64le";
"mips" = "mips";
}.${platform.parsed.cpu.name} or (throw "Unsupported system");
# We need a target compiler which is still runnable at build time,

View file

@ -41,6 +41,7 @@ let
"armv6l" = "arm";
"armv7l" = "arm";
"powerpc64le" = "ppc64le";
"mips" = "mips";
}.${platform.parsed.cpu.name} or (throw "Unsupported system");
# We need a target compiler which is still runnable at build time,

View file

@ -41,6 +41,7 @@ let
"armv6l" = "arm";
"armv7l" = "arm";
"powerpc64le" = "ppc64le";
"mips" = "mips";
}.${platform.parsed.cpu.name} or (throw "Unsupported system");
# We need a target compiler which is still runnable at build time,