From 0cd912186a178aab591bf151a86899dfb0d29fe3 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 18 Oct 2021 14:39:58 +0300 Subject: build-system/go: Fix building on host's secondary architecture. Before when building for i686-linux on x86_64-linux GOARCH would be set to amd64, not 386. * guix/build-system/go.scm (go-build): Set goarch and goos to #f when not cross-compiling. * guix/build/go-build-system.scm (setup-go-environment): Set GOARCH according to the calculated goarch or using GOHOSTARCH and GOOS according to the calculated goos or using GOHOSTOS. --- guix/build/go-build-system.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'guix/build') diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index 645d2fe680..4768ee8562 100644 --- a/guix/build/go-build-system.scm +++ b/guix/build/go-build-system.scm @@ -152,8 +152,10 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke ;; Make sure we're building for the correct architecture and OS targets ;; that Guix targets. - (setenv "GOARCH" goarch) - (setenv "GOOS" goos) + (setenv "GOARCH" (or goarch + (getenv "GOHOSTARCH"))) + (setenv "GOOS" (or goos + (getenv "GOHOSTOS"))) (match goarch ("arm" (setenv "GOARM" "7")) -- cgit v1.2.3