From unknown Fri Jun 13 10:52:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39400: Go retains a reference to GCC Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 02 Feb 2020 22:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39400 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: bug-Guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158068338227013 (code B ref -1); Sun, 02 Feb 2020 22:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Feb 2020 22:43:02 +0000 Received: from localhost ([127.0.0.1]:40700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyNxG-00071T-4S for submit@debbugs.gnu.org; Sun, 02 Feb 2020 17:43:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:60265) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyNxE-00071E-TT for submit@debbugs.gnu.org; Sun, 02 Feb 2020 17:43:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39967) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyNxD-0000BH-Lv for bug-Guix@gnu.org; Sun, 02 Feb 2020 17:43:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED,BAYES_50, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iyNxD-00046F-IU for bug-Guix@gnu.org; Sun, 02 Feb 2020 17:42:59 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55378 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iyNxD-0003YY-4g for bug-Guix@gnu.org; Sun, 02 Feb 2020 17:42:59 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 =?UTF-8?Q?Pluvi=C3=B4se?= an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 02 Feb 2020 23:42:57 +0100 Message-ID: <87v9oo391q.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello! It seems that Go unduly retains a reference to GCC: --8<---------------cut here---------------start------------->8--- $ guix size go store item total s= elf /gnu/store/g4rrz9rnr8ssbnj3gx3dmsxv4glll8nf-go-1.12.15 646.3 = 355.9 55.1% /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0 177.4 = 107.2 16.6% /gnu/store/ziinjmbnq004866mwjrczsk12wf35qb8-perl-5.30.0 148.2 = 57.1 8.8% /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29 37.4 = 35.8 5.5% /gnu/store/64xzk1kwk30n7arqgmxs2qy7wzcnc8i3-gcc-7.4.0-lib 70.1 = 32.8 5.1% /gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib 70.0 = 32.6 5.0% /gnu/store/9kzrrccpzl6i1sfwb0drb00gi2gwk0x0-coreutils-8.31 90.0 = 16.5 2.6% /gnu/store/dvs3acxwfnwgc7yma6h3y937ri2li47y-gmp-6.1.2 72.6 = 2.6 0.4% /gnu/store/9mmsilz9avdl49i6a6nj5mzfyim8ihv2-tzdata-2019c 2.0 = 2.0 0.3% /gnu/store/cp72ncw4prnsga65n3pzll07hpsg524f-bash-static-5.0.7 1.6 = 1.6 0.2% /gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7 38.4 = 1.0 0.2% /gnu/store/nffbgghxyvrj29lcgxs5fpmi3sx9zzql-acl-2.2.53 70.7 = 0.5 0.1% /gnu/store/in1738m2zvhgpz78n2yqa972sdzc42ss-attr-2.4.48 70.3 = 0.3 0.0% /gnu/store/y127kw0vmw46zcrvfz0i5s2rynq7ddjv-zlib-1.2.11 37.6 = 0.2 0.0% /gnu/store/waw5ci4lazbf2a1x9v6gw1v274nk0gny-libcap-2.27 70.2 = 0.2 0.0% /gnu/store/hzk6d08yiih0alc2raciah570plkjxzh-net-base-5.3 0.0 = 0.0 0.0% total: 646.3 MiB $ guix describe Generacio 126 Jan 27 2020 23:59:19 (nuna) guix 93f4511 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: 93f4511eb0c9b33f5083c2a04f4148e0a494059c $ grep -r x3jx25cd3q363mr7nbgzrhrv1vza6cf7 /gnu/store/g4rrz9rnr8ssbnj3gx3dm= sxv4glll8nf-go-1.12.15 Duuma dosiero /gnu/store/g4rrz9rnr8ssbnj3gx3dmsxv4glll8nf-go-1.12.15/bin/go= kongruas Duuma dosiero /gnu/store/g4rrz9rnr8ssbnj3gx3dmsxv4glll8nf-go-1.12.15/pkg/to= ol/linux_amd64/cgo kongruas --8<---------------cut here---------------end--------------->8--- Ludo=E2=80=99. From unknown Fri Jun 13 10:52:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39400: Go retains a reference to GCC In-Reply-To: <87v9oo391q.fsf@gnu.org> Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 04 Jul 2021 05:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39400 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Tobias Geerinckx-Rice , 39400@debbugs.gnu.org Received: via spool by 39400-submit@debbugs.gnu.org id=B39400.162537666816555 (code B ref 39400); Sun, 04 Jul 2021 05:32:02 +0000 Received: (at 39400) by debbugs.gnu.org; 4 Jul 2021 05:31:08 +0000 Received: from localhost ([127.0.0.1]:40312 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzuih-0004Iw-TK for submit@debbugs.gnu.org; Sun, 04 Jul 2021 01:31:08 -0400 Received: from out2.migadu.com ([188.165.223.204]:11194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzuic-0004IS-EZ for 39400@debbugs.gnu.org; Sun, 04 Jul 2021 01:31:06 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1625376660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=zoAuErC406/brLZNmd1bb38h/rCNcuXWqDzO0kMd+1w=; b=OuFA2qpJo7l33cgIWOCNvnVNxZcDHvSnFGdKvnCZL06GlU5bEWPcQMyG6MhPyScX4Dkgah UyWAWYRUvRUAMlMiyL9KZBnFDaSFAROze7LgI2vYg/elEHbjX+9uXjTFfrxTnL/L+liiym PzjF6XFk2kg06ydmTGOaWaSa+G4phNY= From: Sarah Morgensen References: <87v9oo391q.fsf@gnu.org> Date: Sat, 03 Jul 2021 22:30:57 -0700 Message-ID: <86k0m6abn2.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello all, (I have CC'd Tobias since we briefly discussed this on #guix recently.) Ludovic Court=C3=A8s writes: > Hello! > > It seems that Go unduly retains a reference to GCC: > > $ guix size go > store item total = self > /gnu/store/g4rrz9rnr8ssbnj3gx3dmsxv4glll8nf-go-1.12.15 646.3 = 355.9 55.1% > /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0 177.4 = 107.2 16.6% > [...] This is still the case: $ guix size go store item total s= elf /gnu/store/vvly7zgn981brb37v8y8a7f9psx7c6ay-go-1.16.5 570.0 = 371.5 65.2% /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0 178.5 = 107.3 18.8% /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 38.4 = 36.7 6.4% /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib 71.0 = 32.6 5.7% /gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 88.0 = 17.0 3.0% /gnu/store/kl68v5mclwp511xgpsl2h1s9gmsdxpzh-tzdata-2021a 1.9 = 1.9 0.3% /gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16 1.6 = 1.6 0.3% /gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16 39.4 = 1.0 0.2% /gnu/store/g2s5jfkfd4k973wb58476b1bbv9zpm6m-zlib-1.2.11 38.6 = 0.2 0.0% /gnu/store/zfbbn61ij7w0bl4wbrwi87x5ghqx968c-net-base-5.3 0.0 = 0.0 0.0% total: 570.0 MiB But... is the "baking-in" of (a particular version of) GCC a bad thing? I am not sure either way. Go invokes gcc when compiling with cgo, and cgo (or at least the usage of standard libraries which use cgo) is getting fairly common. If we do not provide a default gcc with Go, a plain "go build" will produce an error if it encounters something which uses cgo and it can't find gcc: $ go build # runtime/cgo cgo: exec gcc: exec: "gcc": executable file not found in $PATH The user would then have to either install a gcc-toolchain, or figure out that they must set CGO_ENABLED=3D0. From this perspective, it is more convenient to have GCC baked-in for the average user, who likely has no reason to want a different CC anyway. On the other hand, currently GCC is baked-in to Go in two ways: * CC is set to /gnu/store/...-gcc-7.5.0/bin/gcc * Go is patched so that it adds /gnu/store/...-gcc-7.5.0-lib/lib as a runpath when linking with cgo files This means that even if the user provides a different CC, the gcc-7.5.0-lib dir will also be in the runpath. I do not know if, or how much, this would conflict with other gcc-lib runpaths. I have experimented with a couple ways of removing the gcc-7.5.0 reference: 1. Simply set CC=3Dgcc. This works to remove gcc-7.5.0 from references, but we still get a gcc-7.5.0-lib runpath. We can't remove this runpath completely, as anything using cgo-enabled parts of the standard library require it, and Go does not save the library location anywhere. 2. Make Go require external linking for anything using cgo, which would remove the need to patch internal linking at all. Some platforms do not support internally linking cgo at all, so Go should have no trouble handling this. It does break some tests which expect to be able to internally link, but I have not yet found any actual packages it breaks. My instinct says that removing the reference, and doing so via #2, is the way to go, but I am just a newcomer to Guix. WDYT? -- Sarah From unknown Fri Jun 13 10:52:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39400: Go retains a reference to GCC Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 06 Jul 2021 20:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39400 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Tobias Geerinckx-Rice , 39400@debbugs.gnu.org Received: via spool by 39400-submit@debbugs.gnu.org id=B39400.162560264230953 (code B ref 39400); Tue, 06 Jul 2021 20:18:01 +0000 Received: (at 39400) by debbugs.gnu.org; 6 Jul 2021 20:17:22 +0000 Received: from localhost ([127.0.0.1]:50305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0rVS-00083B-0Y for submit@debbugs.gnu.org; Tue, 06 Jul 2021 16:17:22 -0400 Received: from out1.migadu.com ([91.121.223.63]:34305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0rVP-000830-Ra for 39400@debbugs.gnu.org; Tue, 06 Jul 2021 16:17:21 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1625602637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AozZCJTq1G1NGnTFN/tqe56I5JefHP/L7DtbihOUY4w=; b=Xk4Aso7fuNXj4tlXEwEt1bSPH1EG5ErvABwrrjJsIzGuzuV+Me/GUC5jS7gjvWRt+XkdmF 6YaTDAiOzp5MH2BNTqCEYj7sq48C58HGp2yhS1oVavtUM5GugeLTE6vGMgXDkHqK9BdW8L iS12WPsR51es1yuVyFedgcpac+dI5cU= From: Sarah Morgensen References: <87v9oo391q.fsf@gnu.org> <86k0m6abn2.fsf@mgsn.dev> Date: Tue, 06 Jul 2021 13:17:15 -0700 In-Reply-To: <86k0m6abn2.fsf@mgsn.dev> (Sarah Morgensen's message of "Sat, 03 Jul 2021 22:30:57 -0700") Message-ID: <86k0m3jiyc.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, A quick addendum... Sarah Morgensen writes: > This means that even if the user provides a different CC, the > gcc-7.5.0-lib dir will also be in the runpath. I do not know if, or how > much, this would conflict with other gcc-lib runpaths. > I have just seen the consequences of this: the binary is unable to load symbols from the newer library. More info at . > I have experimented with a couple ways of removing the gcc-7.5.0 reference: > > 1. Simply set CC=gcc. This works to remove gcc-7.5.0 from references, > but we still get a gcc-7.5.0-lib runpath. We can't remove this runpath > completely, as anything using cgo-enabled parts of the standard library > require it, and Go does not save the library location anywhere. > -- Sarah From unknown Fri Jun 13 10:52:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39400: Go retains a reference to GCC Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 07 Jul 2021 21:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39400 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Sarah Morgensen Cc: Tobias Geerinckx-Rice , 39400@debbugs.gnu.org Received: via spool by 39400-submit@debbugs.gnu.org id=B39400.162569457021930 (code B ref 39400); Wed, 07 Jul 2021 21:50:01 +0000 Received: (at 39400) by debbugs.gnu.org; 7 Jul 2021 21:49:30 +0000 Received: from localhost ([127.0.0.1]:53678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1FQA-0005he-BY for submit@debbugs.gnu.org; Wed, 07 Jul 2021 17:49:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1FQ7-0005hQ-P6 for 39400@debbugs.gnu.org; Wed, 07 Jul 2021 17:49:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46782) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1FQ0-0008QM-P8; Wed, 07 Jul 2021 17:49:20 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42812 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1FQ0-0007jm-Ez; Wed, 07 Jul 2021 17:49:20 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87v9oo391q.fsf@gnu.org> <86k0m6abn2.fsf@mgsn.dev> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Messidor an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 07 Jul 2021 23:49:18 +0200 In-Reply-To: <86k0m6abn2.fsf@mgsn.dev> (Sarah Morgensen's message of "Sat, 03 Jul 2021 22:30:57 -0700") Message-ID: <87k0m1okv5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Sarah Morgensen skribis: > Ludovic Court=C3=A8s writes: > >> Hello! >> >> It seems that Go unduly retains a reference to GCC: >> >> $ guix size go >> store item total = self >> /gnu/store/g4rrz9rnr8ssbnj3gx3dmsxv4glll8nf-go-1.12.15 646.3= 355.9 55.1% >> /gnu/store/x3jx25cd3q363mr7nbgzrhrv1vza6cf7-gcc-7.4.0 177.4= 107.2 16.6% >> [...] > > This is still the case: > > $ guix size go > store item total = self > /gnu/store/vvly7zgn981brb37v8y8a7f9psx7c6ay-go-1.16.5 570.0 = 371.5 65.2% > /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0 178.5 = 107.3 18.8% > /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 38.4 = 36.7 6.4% > /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib 71.0 = 32.6 5.7% > /gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 88.0 = 17.0 3.0% > /gnu/store/kl68v5mclwp511xgpsl2h1s9gmsdxpzh-tzdata-2021a 1.9 = 1.9 0.3% > /gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16 1.6 = 1.6 0.3% > /gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16 39.4 = 1.0 0.2% > /gnu/store/g2s5jfkfd4k973wb58476b1bbv9zpm6m-zlib-1.2.11 38.6 = 0.2 0.0% > /gnu/store/zfbbn61ij7w0bl4wbrwi87x5ghqx968c-net-base-5.3 0.0 = 0.0 0.0% > total: 570.0 MiB > > But... is the "baking-in" of (a particular version of) GCC a bad thing? > I am not sure either way. > > Go invokes gcc when compiling with cgo, and cgo (or at least the usage > of standard libraries which use cgo) is getting fairly common. If we do > not provide a default gcc with Go, a plain "go build" will produce an > error if it encounters something which uses cgo and it can't find gcc: > > $ go build > # runtime/cgo > cgo: exec gcc: exec: "gcc": executable file not found in $PATH Ah, I didn=E2=80=99t know about cgo (a helper for C bindings, right?). I think it=E2=80=99s a case where =E2=80=9Cdynamic composition=E2=80=9D (i.= e., looking for gcc in $PATH at run time) is preferable, because there are lots of situations where gcc is not needed at all. [...] > I have experimented with a couple ways of removing the gcc-7.5.0 referenc= e: > > 1. Simply set CC=3Dgcc. This works to remove gcc-7.5.0 from references, > but we still get a gcc-7.5.0-lib runpath. We can't remove this runpath > completely, as anything using cgo-enabled parts of the standard library > require it, and Go does not save the library location anywhere. Sounds good to me. (gcc-7.5.0-lib is always in the RUNPATH of executables, we don=E2=80=99t have to worry about this one.) > 2. Make Go require external linking for anything using cgo, which would > remove the need to patch internal linking at all. Some platforms do not > support internally linking cgo at all, so Go should have no trouble > handling this. It does break some tests which expect to be able to > internally link, but I have not yet found any actual packages it breaks. What do you mean by =E2=80=9Cexternal linking=E2=80=9D and =E2=80=9Cinterna= l linking=E2=80=9D in this context? (I know very little about Go.) Thanks! Ludo=E2=80=99. From unknown Fri Jun 13 10:52:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39400: Go retains a reference to GCC Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 08 Jul 2021 01:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39400 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Tobias Geerinckx-Rice , 39400@debbugs.gnu.org Received: via spool by 39400-submit@debbugs.gnu.org id=B39400.16257092787101 (code B ref 39400); Thu, 08 Jul 2021 01:55:02 +0000 Received: (at 39400) by debbugs.gnu.org; 8 Jul 2021 01:54:38 +0000 Received: from localhost ([127.0.0.1]:53879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1JFN-0001qT-ON for submit@debbugs.gnu.org; Wed, 07 Jul 2021 21:54:37 -0400 Received: from out1.migadu.com ([91.121.223.63]:33491) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1JFK-0001qI-4f for 39400@debbugs.gnu.org; Wed, 07 Jul 2021 21:54:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1625709272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jjKvwsLIj9QbEFrwLqor2d+QAP6+swBDeuVGdYjBOP0=; b=FmT7wnIv7lMPPVN3q8+tAMvVE0q/JMjNz4vR7zuR162x3voRbwY9zCpsnk1ndaxPlxBuEJ Dc+6TB0/G6y3rjn+qIJYpA3zZbIGeONr7bXg1x5H7L46cDm6WphfIU2FvqZKSPV8WCPmpp HI256+xfdF0KCnw63sYIl4ilvlvQa5o= From: Sarah Morgensen References: <87v9oo391q.fsf@gnu.org> <86k0m6abn2.fsf@mgsn.dev> <87k0m1okv5.fsf@gnu.org> Date: Wed, 07 Jul 2021 18:54:29 -0700 In-Reply-To: <87k0m1okv5.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 07 Jul 2021 23:49:18 +0200") Message-ID: <86bl7dk1t6.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Ludovic Court=C3=A8s writes: >> Go invokes gcc when compiling with cgo, and cgo (or at least the usage >> of standard libraries which use cgo) is getting fairly common. If we do >> not provide a default gcc with Go, a plain "go build" will produce an >> error if it encounters something which uses cgo and it can't find gcc: >> >> $ go build >> # runtime/cgo >> cgo: exec gcc: exec: "gcc": executable file not found in $PATH > > Ah, I didn=E2=80=99t know about cgo (a helper for C bindings, right?). Yes, cgo allows you to compile Go programs which interface with C, as well as straight .c files. > > I think it=E2=80=99s a case where =E2=80=9Cdynamic composition=E2=80=9D (= i.e., looking for gcc > in $PATH at run time) is preferable, because there are lots of > situations where gcc is not needed at all. > > [...] > >> I have experimented with a couple ways of removing the gcc-7.5.0 referen= ce: >> >> 1. Simply set CC=3Dgcc. This works to remove gcc-7.5.0 from references, >> but we still get a gcc-7.5.0-lib runpath. We can't remove this runpath >> completely, as anything using cgo-enabled parts of the standard library >> require it, and Go does not save the library location anywhere. > > Sounds good to me. (gcc-7.5.0-lib is always in the RUNPATH of > executables, we don=E2=80=99t have to worry about this one.) I recently discovered that there is actually an issue with this particular approach. If the user uses a newer gcc-toolchain, the always-added gcc-7.5.0-lib shadows the newer libraries and newer symbols are unavailable. See . > >> 2. Make Go require external linking for anything using cgo, which would >> remove the need to patch internal linking at all. Some platforms do not >> support internally linking cgo at all, so Go should have no trouble >> handling this. It does break some tests which expect to be able to >> internally link, but I have not yet found any actual packages it breaks. > > What do you mean by =E2=80=9Cexternal linking=E2=80=9D and =E2=80=9Cinter= nal linking=E2=80=9D in this > context? (I know very little about Go.) "external linking" =3D> Go invokes gcc to link object files together "internal linking" =3D> Go does the linking itself -- Sarah