From c00d507f97fb4e4aa121d3df288a56c9a2c9585d Mon Sep 17 00:00:00 2001 From: Serge Bazanski Date: Tue, 20 Jul 2021 23:39:32 +0200 Subject: 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. --- pkgs/development/compilers/go/1.14.nix | 1 + pkgs/development/compilers/go/1.15.nix | 1 + pkgs/development/compilers/go/1.16.nix | 1 + 3 files changed, 3 insertions(+) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/go/1.14.nix b/pkgs/development/compilers/go/1.14.nix index e8a90ac0b8d..21080fd96cb 100644 --- a/pkgs/development/compilers/go/1.14.nix +++ b/pkgs/development/compilers/go/1.14.nix @@ -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, diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index 8dee4cae896..74ab1342dab 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -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, diff --git a/pkgs/development/compilers/go/1.16.nix b/pkgs/development/compilers/go/1.16.nix index f85d2bba907..49a2f9656f3 100644 --- a/pkgs/development/compilers/go/1.16.nix +++ b/pkgs/development/compilers/go/1.16.nix @@ -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, -- cgit 1.4.1