unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Famulari <leo@famulari.name>
To: guix-devel@gnu.org
Subject: Removing a store reference from a file
Date: Thu, 26 Oct 2017 11:04:43 -0400	[thread overview]
Message-ID: <20171026150443.GA17580@jasmine.lan> (raw)

[-- Attachment #1: Type: text/plain, Size: 1984 bytes --]

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/39cd40f7bea40116ecb756d46a687bfd0d2e550e/pkgs/development/go-modules/generic/default.nix#L29

... 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/39cd40f7bea40116ecb756d46a687bfd0d2e550e/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 
execve("./syncthing", ["./syncthing"], [/* 42 vars */]) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
write(2, "strace: exec: No such file or directory\n", 40strace: exec: No such file or directory
) = 40
getpid()                                = 5493
exit_group(1)                           = ?
+++ exited with 1 +++
------

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2017-10-26 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 15:04 Leo Famulari [this message]
2017-10-27  0:43 ` Removing a store reference from a file Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171026150443.GA17580@jasmine.lan \
    --to=leo@famulari.name \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).