From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Removing a store reference from a file Date: Thu, 26 Oct 2017 11:04:43 -0400 Message-ID: <20171026150443.GA17580@jasmine.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7jiG-0002oa-SB for guix-devel@gnu.org; Thu, 26 Oct 2017 11:04:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7jiC-0007wW-Rq for guix-devel@gnu.org; Thu, 26 Oct 2017 11:04:52 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35233) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7jiC-0007vg-JL for guix-devel@gnu.org; Thu, 26 Oct 2017 11:04:48 -0400 Received: from localhost (c-73-165-108-70.hsd1.pa.comcast.net [73.165.108.70]) by mail.messagingengine.com (Postfix) with ESMTPA id E65F27FAA3 for ; Thu, 26 Oct 2017 11:04:44 -0400 (EDT) Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I noticed that Go executables built with the go-build-system keep an unnecessary reference to Go itself: $ guix gc --references $(realpath $(which syncthing)) /gnu/store/3h31zsqxjjg52da5gp3qmhkh4x8klhah-glibc-2.25 /gnu/store/bqlmgk6ngyi4pivnqpxma2wr5pj5mhkk-gcc-5.4.0-lib /gnu/store/bzj472nmnnj5hcfd5yvfiqip1wzw84p9-tzdata-2017b /gnu/store/qydgxm0sipn4bn5122a3zxiz1bz0vvnw-go-1.9.2 /gnu/store/z1lii251cy0y660910hsfc55cy82dk9i-net-base-5.3 The programs don't need or use this reference, so it would be nice to get rid of it and save users some bandwidth when installing Go programs. I'm still figuring out the best way to approach this issue (Go compiler flags?), but here is some research. In Nixpkgs, there is a switch to disallow this reference specifically: ------ # Do not enable this without good reason # IE: programs coupled with the compiler , allowGoReference ? false ------ https://github.com/NixOS/nixpkgs/blob/39cd40f7bea40116ecb756d46a687bfd0d2e5= 50e/pkgs/development/go-modules/generic/default.nix#L29 =2E.. and it ends in a call to a general-purpose shell script, remove-references-to, which uses sed to remove specific references: https://github.com/NixOS/nixpkgs/blob/39cd40f7bea40116ecb756d46a687bfd0d2e5= 50e/pkgs/build-support/remove-references-to/default.nix I see that in Guix we have ((guix build utils) remove-store-references), which removes *all* store references from a file, but using it here leaves the Go executable unable to even start execution. I think it needs libc's linker: ------ % strace -s1000 -f ./syncthing=20 execve("./syncthing", ["./syncthing"], [/* 42 vars */]) =3D -1 ENOENT (No s= uch file or directory) fstat(2, {st_mode=3DS_IFCHR|0620, st_rdev=3Dmakedev(136, 3), ...}) =3D 0 write(2, "strace: exec: No such file or directory\n", 40strace: exec: No su= ch file or directory ) =3D 40 getpid() =3D 5493 exit_group(1) =3D ? +++ exited with 1 +++ ------ --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlnx+YsACgkQJkb6MLrK fwibChAAxBgh5Hj3wmHEEOhNwceyw85Akr6xeq+xVW7son4+N05qmh1+/5TAZijG v06kt4Y1tHII9EGuPpe3ynsdQt8pu1mmE4z1a10G+BDP038O60qTz+KVyylqQDX7 /ZsBbZefGkI+wzaiki2BNjPTkN2+voIWPpjTraNHr0I0n0bhVwYvJGSn0hK152fQ mSQxmBCvcJEvx4xju6aJalShsKgMb91pwZYWbH7Mf362mrD44+3/b9CaLIAvRVr/ GwiZG4BrEV6eLWf+SRFLB/mnJW3e/PlHCiEUHvzkdZPGC6nR08qhQn424KVrCq3Q ggT6uV73H4KBSfnM8Fwvzu+I+I12ARaQXvIm7hqvTd4RaA3bq3OnCPiOZ1izzK5S exbZ4wvLmMJmx+Jk5QGgw4KY9kS5RnJ+305HJG0piLSb9j64Hnn759i3sByF7oy4 k/nhcn2gKbXjNqqRR1/DN2gzRLc9nqVkes6DCA+rdYeETmDgBlr7px27ry0TGM88 y1qZrdOEkJrIp0YMZZAHTH1Smt0oH4xUWB8Adyi946498tvEmkdXx9fhdFFnUZqi fhXI6LlvEoMl7POgo56mAUI8cS1k0mBO7lrL9zpyf1BGd3NZFMuGhHVbhoDHSGNN AgRB/e1Z0h6dFayrHve4+OKsaNeJYTkhbCegk+Z9AZLHmnP3ad4= =exi8 -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--