(address . bug-guix@gnu.org)
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:
Toggle snippet (16 lines)
$ 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
and this is the size of the unpatched GHC:
Toggle snippet (27 lines)
$ 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
This is what the settings file looks like:
Toggle snippet (39 lines)
[("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")
]
--
Ricardo