GNU bug report logs - #51981
[PATCH 0/1] Fix cross-compilation of packages that use go-build-system

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: "Collin J. Doering" <collin@HIDDEN>; Keywords: patch; dated Fri, 19 Nov 2021 20:18:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added tag(s) patch. Request was from "Collin J. Doering" <collin@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Changed bug title to '[PATCH 0/1] Fix cross-compilation of packages that use go-build-system' from '(no subject)' Request was from "Collin J. Doering" <collin@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 51981 <at> debbugs.gnu.org:


Received: (at 51981) by debbugs.gnu.org; 19 Nov 2021 20:38:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 19 15:38:07 2021
Received: from localhost ([127.0.0.1]:40625 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1moAe7-0006eT-Ky
	for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 15:38:07 -0500
Received: from mail-qv1-f42.google.com ([209.85.219.42]:38759)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <collin@HIDDEN>) id 1moAe6-0006e0-Oe
 for 51981 <at> debbugs.gnu.org; Fri, 19 Nov 2021 15:38:07 -0500
Received: by mail-qv1-f42.google.com with SMTP id a24so7942096qvb.5
 for <51981 <at> debbugs.gnu.org>; Fri, 19 Nov 2021 12:38:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rekahsoft.ca; s=google;
 h=user-agent:from:to:subject:date:message-id:mime-version;
 bh=lpVfeW0sCsA8Kz2dra1X63GLrzo+ZGZs7Crh8ktfZDQ=;
 b=jMb7nuZ+ymebVhdneh95/QFvFNjUVi9Ii6PIyMcb69TTBsfMTbfE+fljFDzt5iVIY+
 ikCtC3Udtl9B5Yx/ePgQsUngLfowdWSJnZMOdQ5K3D6kusEYLGB5I2IXZp2De69odFrk
 fBlxMUMUVlzQ3cEplkj7BnaAaKX6s3Y01ua44SlWHbnrOZqQehIkPQ8IDMmzay/eVfgV
 8EDf9yQvezacCOMH3qcM8APHfnTbhK6GTfrs+b308K6bTmn/GaLYXs0wEKcMBZcOH9yd
 YYapiqM9z34bn/n11ubW9FWAgUQWcA5G31YlcSFb2HR1Ht04zp3ECRT4pc/EaIDdYup7
 ouKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:user-agent:from:to:subject:date:message-id
 :mime-version;
 bh=lpVfeW0sCsA8Kz2dra1X63GLrzo+ZGZs7Crh8ktfZDQ=;
 b=ee1kwt/aiFtOFJjkmZdof7VDzVfUEjAs0KE7uUdYR6Kjis8U6pqgaMjXVpQTMfqXBB
 VVxy1PcUCgS2zvM+VJNHrYSYcE0X7tXr8zYpgOOLSqLABPGADExIcJUstT4WzOaUf4PI
 CGItV4icJ6hrORx5+3N4fjUuJcSQVGsUAvI14ozXRx7m/s24+tK+nhncPTQkfwSRn5mP
 oqEmEc70I529EyZrHJu8sc1Xl/0EEwvhkLpUaDbPTD3fwhoAJlhHpdUIpJ7NUw42m1pL
 i9QXK1nPxd/MEvBl9I0fJIdZX6qU8J8mO4ytYJlLAyaGAkzeEk3ZiVSeTuJeiSZuEOpF
 u2Yw==
X-Gm-Message-State: AOAM533DTi6h+1iV7M8GFlSuF976DBTs0jj2EVKTczCpQYtD3Jwzr2Oo
 Ny26xRkLKedfBGP6PNCUJuHcJ9MM+UdyoA==
X-Google-Smtp-Source: ABdhPJwCpEc3w9BHyW77Kf9ppZq2Gbmh6TY3xmUMjw45N38iEdMVHVdL6RarQGiw2eE2qk6ThURcXA==
X-Received: by 2002:ad4:5aa1:: with SMTP id u1mr78360148qvg.44.1637354280819; 
 Fri, 19 Nov 2021 12:38:00 -0800 (PST)
Received: from rekahsoft-work
 (cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com. [99.255.210.233])
 by smtp.gmail.com with ESMTPSA id o5sm368676qkl.50.2021.11.19.12.38.00
 for <51981 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 19 Nov 2021 12:38:00 -0800 (PST)
User-agent: mu4e 1.6.10; emacs 27.2
From: "Collin J. Doering" <collin@HIDDEN>
To: 51981 <at> debbugs.gnu.org
Subject: [PATCH 1/1] build: Fix cross compilation for go-build-system
Date: Fri, 19 Nov 2021 15:37:34 -0500
Message-ID: <877dd36fvc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 51981
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

---
 guix/build/go-build-system.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 4768ee8562..f36e98f47a 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -148,7 +148,6 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke
   ;; currently support modules, so turn modules off to continue using the old
   ;; GOPATH behavior.
   (setenv "GO111MODULE" "off")
-  (setenv "GOBIN" (string-append (assoc-ref outputs "out") "/bin"))
 
   ;; Make sure we're building for the correct architecture and OS targets
   ;; that Guix targets.
@@ -234,14 +233,19 @@ (define (go-inputs inputs)
                 (_ #f))
               inputs))))
 
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key outputs import-path build-flags #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
   (with-throw-handler
     #t
     (lambda _
-      (apply invoke "go" "install"
+      (apply invoke "go" "build"
               "-v" ; print the name of packages as they are compiled
               "-x" ; print each command as it is invoked
+              ;; Set the output path for the build
+              (string-append "-o="
+                (assoc-ref outputs "out") "/bin/"
+                (package-name->name+version
+                  (strip-store-file-name (assoc-ref outputs "out"))))
               ;; Respectively, strip the symbol table and debug
               ;; information, and the DWARF symbol table.
               "-ldflags=-s -w"
-- 
2.33.1


-- 
Collin J. Doering

http://rekahsoft.ca
http://blog.rekahsoft.ca
http://git.rekahsoft.ca




Information forwarded to guix-patches@HIDDEN:
bug#51981; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Nov 2021 20:17:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 19 15:17:41 2021
Received: from localhost ([127.0.0.1]:40611 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1moAKL-00063Y-G1
	for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 15:17:41 -0500
Received: from lists.gnu.org ([209.51.188.17]:33006)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <collin@HIDDEN>) id 1moAKK-00063R-91
 for submit <at> debbugs.gnu.org; Fri, 19 Nov 2021 15:17:40 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47198)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <collin@HIDDEN>)
 id 1moAKK-0003sl-4I
 for guix-patches@HIDDEN; Fri, 19 Nov 2021 15:17:40 -0500
Received: from [2607:f8b0:4864:20::f2a] (port=42498
 helo=mail-qv1-xf2a.google.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <collin@HIDDEN>)
 id 1moAKF-0003AL-LB
 for guix-patches@HIDDEN; Fri, 19 Nov 2021 15:17:39 -0500
Received: by mail-qv1-xf2a.google.com with SMTP id b17so7891334qvl.9
 for <guix-patches@HIDDEN>; Fri, 19 Nov 2021 12:17:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rekahsoft.ca; s=google;
 h=user-agent:from:to:date:message-id:mime-version;
 bh=4icf3bRtgKiz0LAERPlb7jTDwea+iTFNnZ+q8n9+RFo=;
 b=Pm2d0ESrJg0nvDeL7+IZSen0mVn8hkPqJAHD/yYTFH7uanJA9K3WJ2NnqTs6/tbnKH
 DTZDSH0kpHedc3oPQV47U/1jMOi1RWU43XzlZTCVBPJwQMxTrel67Nc3toysPnrHmSiw
 q9RQVnpyIai/Hy/8lN2srzZXqvnWARHHC5w8nSBwu2Kg41DOGh5XGdPaNpSt3DilYIUb
 aUN4nswaxgyO7GsX23WII2hv8xPktPwfXBGpD9Ev6rv3pR0A8t1vVoiWD4iD7ml9e0fR
 Wa2avrt1jiTcp7gjS73ddcnA8RfmKd+igd0dc1hox8ejVqjz+ZXtB/F3ES+8BQIFHIs8
 OdCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:user-agent:from:to:date:message-id:mime-version;
 bh=4icf3bRtgKiz0LAERPlb7jTDwea+iTFNnZ+q8n9+RFo=;
 b=Gq/hNAC4kPJnelsPXpe1DlFOCfpF+wQFOuQTlwFyq2ABLbRTtWN10EK3zO9rhxqIbT
 +8eu371pp7bVDcJF8Af7K82MUTqUzxCNo3Um9ku4bLw8LgCqp7Xq5WoUh5KLmRiKNk0I
 RUs2ytZUdSNpTupVXz93z+zpv+S221gb2xzzElNyfouXD79TYKG64j36lZHptHHD25z3
 EzDcvPoKnQjIqpX198b6vjxG2woSen/PdAd0RI74AxwG7QU9oqNA3h6URNgN+FkM3DYn
 BE8g8fy1JUhuTdVebPBu91Ao9f6Q+nd4F0onCL21Musd4C4QKrG1/sH2xVhal5kRxwoH
 ODEQ==
X-Gm-Message-State: AOAM531noCp+pDw5rjgGM9UcGpSIl2trfW2sA7p4LrJQImf+btfSkdSm
 agY1uRgIx6C1l4XUxIDpleGu0egv7qb2QA==
X-Google-Smtp-Source: ABdhPJyWj4o8rTjRpxmp2LOB4OTU8LwpBaRIpwTJLjOf6oCv/YhHm38GnBD4h4ZE0QsA3WBdKsobpw==
X-Received: by 2002:a0c:f8cc:: with SMTP id h12mr75910808qvo.6.1637353052269; 
 Fri, 19 Nov 2021 12:17:32 -0800 (PST)
Received: from rekahsoft-work
 (cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com. [99.255.210.233])
 by smtp.gmail.com with ESMTPSA id bk18sm407329qkb.35.2021.11.19.12.17.31
 for <guix-patches@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 19 Nov 2021 12:17:31 -0800 (PST)
User-agent: mu4e 1.6.10; emacs 27.2
From: "Collin J. Doering" <collin@HIDDEN>
To: guix-patches@HIDDEN
Date: Fri, 19 Nov 2021 14:59:07 -0500
Message-ID: <87bl2f6gti.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::f2a
 (failed)
Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a;
 envelope-from=collin@HIDDEN; helo=mail-qv1-xf2a.google.com
X-Spam_score_int: 5
X-Spam_score: 0.5
X-Spam_bar: /
X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MISSING_SUBJECT=1.799,
 PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.6 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

Hi all,

This patch resolves an issue I discovered when attempting to cross-compile packages that use the go-build-system.

Namely, prior to this patch, running 'guix build --target=arm-unknown-linux-gnueabihf <go-package>' where '<go-package>' is some package that uses to go-build-system (for example, 'fzf'), would result in the following error in the build log:

--8<---------------cut here---------------start------------->8---
go install: cannot install cross-compiled binaries when GOBIN is set
Building 'github.com/junegunn/fzf' failed.
Here are the results of `go env`:
GO111MODULE="off"
GOARCH="arm"
GOBIN="/gnu/store/8xcs9vna6zyl814j78raynccm7mqqk0h-fzf-0.25.0/bin"
GOCACHE="/tmp/go-cache"
GOENV="/homeless-shelter/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/tmp/guix-build-fzf-0.25.0.drv-0"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/gnu/store/y5rwacd5l4q26pxis28wsmswj2603hkw-go-1.14.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/gnu/store/y5rwacd5l4q26pxis28wsmswj2603hkw-go-1.14.15/pkg/tool/linux_amd64"
GCCGO="gccgo"
GOARM="7"
AR="ar"
CC="/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -fmessage-length=0 -fdebug-prefix-map=/tmp/guix-build-fzf-0.25.0.drv-0/go-build219362912=/tmp/go-build -gno-record-gcc-switches"
command "go" "install" "-v" "-x" "-ldflags=-s -w" "github.com/junegunn/fzf" failed with status 1
--8<---------------cut here---------------end--------------->8---

The important bit is the first line, which indicates that 'GOBIN' cannot be set when cross-compiling. This has been the case in go from what I can tell for numerous years (atleast 2019).

This patch removes the setting of 'GOBIN' and adjusts the go-build-systems build function to us 'go build' instead of 'go install'.

Collin J. Doering (1):
  build: Fix cross compilation for go-build-system

 guix/build/go-build-system.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
2.33.1

-- 
Collin J. Doering

http://rekahsoft.ca
http://blog.rekahsoft.ca
http://git.rekahsoft.ca




Acknowledgement sent to "Collin J. Doering" <collin@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN.

Your message did not contain a Subject field. They are recommended and useful because the title of a $gBug is determined using this field. Please remember to include a Subject field in your messages in future.

Full text available.


Report forwarded to guix-patches@HIDDEN:
bug#51981; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 19 Nov 2021 21:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.