GNU bug report logs - #41508
GHC retains references to Perl, GCC, and others

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Sun, 24 May 2020 14:29:01 UTC

Severity: normal

To reply to this bug, email your comments to 41508 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#41508; Package guix. (Sun, 24 May 2020 14:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 24 May 2020 14:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: bug-guix <at> gnu.org
Subject: GHC retains references to Perl, GCC, and others
Date: Sun, 24 May 2020 16:28:18 +0200
GHC installs a lib/settings file with references to build-time tools,
such as Perl, GCC, and others.

I tried building with a phase that removed those references:

     (match (find-files (string-append (assoc-ref outputs "out") "/lib")
                        "settings")
       ((settings)
        (remove-store-references settings))
       (_ #f))

Unfortunately, this breaks all Haskell packages as GHC always first
tries to set up its build environment.  Any Haskell package’s configure
phase fails as GHC fails to find GCC.

It seems to me that the only way around this is to patch GHC to allow
looking up of GCC and Perl through environment variables, but perhaps
this is unrealistic.

For comparison, this is the size of the broken GHC:

--8<---------------cut here---------------start------------->8---
$ guix size /gnu/store/x2rv5wz3d9z35p93sjv42gxs34y18ky3-ghc-8.6.5
store item                                                       total    self
/gnu/store/x2rv5wz3d9z35p93sjv42gxs34y18ky3-ghc-8.6.5             1639.2  1358.0  82.8%
/gnu/store/g8x8isxfg7in2w4jrmmh9r4zb9c8vfwn-ghc-8.6.5-doc          165.7   126.3   7.7%
/gnu/store/8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2            146.2    57.1   3.5%
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31              38.4    36.7   2.2%
/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib           71.0    32.6   2.0%
/gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32          88.0    17.0   1.0%
/gnu/store/zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2             76.9     5.9   0.4%
/gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0               73.8     2.7   0.2%
/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16       1.6     1.6   0.1%
/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16     39.4     1.0   0.1%
/gnu/store/bw15z9kh9c65ycc2vbhl2izwfwfva7p1-libffi-3.3              71.2     0.2   0.0%
total: 1639.2 MiB
--8<---------------cut here---------------end--------------->8---

and this is the size of the unpatched GHC:

--8<---------------cut here---------------start------------->8---
$ guix size $(guix build ghc)
store item                                                       total    self
/gnu/store/vdwkplh23jr54bg9mqvym26l8fv6x6kw-ghc-8.6.5             1862.1  1346.9  72.3%
/gnu/store/6yx0cw49561iyikkvb37hd0li6hkcg8z-ghc-8.6.5-doc          176.7   137.3   7.4%
/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0              178.5   107.3   5.8%
/gnu/store/8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2            146.2    57.1   3.1%
/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34           93.0    54.6   2.9%
/gnu/store/0m0vd873jp61lcm4xa3ljdgx381qa782-guile-3.0.2            132.8    53.2   2.9%
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31              38.4    36.7   2.0%
/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib           71.0    32.6   1.8%
/gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32          88.0    17.0   0.9%
/gnu/store/zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2             76.9     5.9   0.3%
/gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0               73.8     2.7   0.1%
/gnu/store/6fvqsjy4m5zbkipwh8grv94snlhnsnag-gmp-6.2.0               73.8     2.7   0.1%
/gnu/store/rip41jax9swcx356sj43h5xqads9fih5-libunistring-0.9.10     73.4     2.4   0.1%
/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16       1.6     1.6   0.1%
/gnu/store/58aqsgnc8sz70zkqp6ad9k72s7vy2fk5-pkg-config-0.29.2       72.3     1.3   0.1%
/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16     39.4     1.0   0.1%
/gnu/store/hg5z55cy28qxq3v2s9d9lw6dkhyfya84-libgc-8.0.4             71.8     0.8   0.0%
/gnu/store/g2s5jfkfd4k973wb58476b1bbv9zpm6m-zlib-1.2.11             38.6     0.2   0.0%
/gnu/store/bw15z9kh9c65ycc2vbhl2izwfwfva7p1-libffi-3.3              71.2     0.2   0.0%
/gnu/store/vd0876ky3ip8zgl5m15l23vqnpqx7y5v-libffi-3.3              71.2     0.2   0.0%
/gnu/store/vv9j7pi05daplyv61jv9yhj5vpmn0p2n-libltdl-2.4.6           71.2     0.2   0.0%
/gnu/store/mpa04aq8lblbcviyxywxcsb1zbi0mf39-ld-wrapper-0           187.5     0.1   0.0%
total: 1862.1 MiB
--8<---------------cut here---------------end--------------->8---

This is what the settings file looks like:

--8<---------------cut here---------------start------------->8---
[("GCC extra via C opts", " -fwrapv -fno-builtin"),
 ("C compiler command", "/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/gcc"),
 ("C compiler flags", " -fno-stack-protector"),
 ("C compiler link flags", " "),
 ("C compiler supports -no-pie", "YES"),
 ("Haskell CPP command","/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/gcc"),
 ("Haskell CPP flags","-E -undef -traditional"),
 ("ld command", "/gnu/store/mpa04aq8lblbcviyxywxcsb1zbi0mf39-ld-wrapper-0/bin/ld"),
 ("ld flags", ""),
 ("ld supports compact unwind", "YES"),
 ("ld supports build-id", "YES"),
 ("ld supports filelist", "NO"),
 ("ld is GNU ld", "YES"),
 ("ar command", "/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/bin/ar"),
 ("ar flags", "q"),
 ("ar supports at file", "YES"),
 ("ranlib command", "/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/bin/ranlib"),
 ("touch command", "touch"),
 ("dllwrap command", "/bin/false"),
 ("windres command", "/bin/false"),
 ("libtool command", "libtool"),
 ("perl command", "/gnu/store/8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2/bin/perl"),
 ("cross compiling", "NO"),
 ("target os", "OSLinux"),
 ("target arch", "ArchX86_64"),
 ("target word size", "8"),
 ("target has GNU nonexec stack", "True"),
 ("target has .ident directive", "True"),
 ("target has subsections via symbols", "False"),
 ("target has RTS linker", "YES"),
 ("Unregisterised", "NO"),
 ("LLVM llc command", "llc"),
 ("LLVM opt command", "opt"),
 ("LLVM clang command", "clang")
 ]

--8<---------------cut here---------------end--------------->8---


-- 
Ricardo




Information forwarded to bug-guix <at> gnu.org:
bug#41508; Package guix. (Tue, 26 May 2020 07:20:01 GMT) Full text and rfc822 format available.

Message #8 received at 41508 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 41508 <at> debbugs.gnu.org
Subject: Re: GHC retains references to Perl, GCC, and others
Date: Tue, 26 May 2020 09:07:24 +0200
Ricardo Wurmus <rekado <at> elephly.net> writes:

> GHC installs a lib/settings file with references to build-time tools,
> such as Perl, GCC, and others.
>
> I tried building with a phase that removed those references:
>
>      (match (find-files (string-append (assoc-ref outputs "out") "/lib")
>                         "settings")
>        ((settings)
>         (remove-store-references settings))
>        (_ #f))
>
> Unfortunately, this breaks all Haskell packages as GHC always first
> tries to set up its build environment.  Any Haskell package’s configure
> phase fails as GHC fails to find GCC.
>
> It seems to me that the only way around this is to patch GHC to allow
> looking up of GCC and Perl through environment variables, but perhaps
> this is unrealistic.

When I looked at that settings file again, I noticed that the LLVM tools
are named without an absolute file name.  So I patched it to refer to
its tools by the basename (“gcc” instead of “/gnu/store/…/bin/gcc”, etc)
and that did the trick.

--8<---------------cut here---------------start------------->8---
   (substitute* (find-files (string-append (assoc-ref outputs "out") "/lib/")
                            "settings")
     (("/gnu/store/.*/bin/(.*)" m program) program))
--8<---------------cut here---------------end--------------->8---

This means, however, that people who install GHC to compile things will
need to also install gcc-toolchain (and perhaps perl), as GHC will try
to invoke them.  Not propagating these tools means that users of Haskell
packages providing an executable (such as Pandoc) will benefit from a
smaller package closure.

Perhaps it would be better not to mess with the “settings” file and
instead work on cutting references from Haskell packages to GHC itself.
The main reason why Haskell packages retain references to GHC is due to
the set of Haskell packages that GHC provides.  If we could separate GHC
from the set of core packages it provides then Haskell packages could
reference the packages they depend on without also dragging in GHC
itself.

-- 
Ricardo




This bug report was last modified 3 years and 307 days ago.

Previous Next


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