From debbugs-submit-bounces@debbugs.gnu.org Sun May 24 10:28:47 2020 Received: (at submit) by debbugs.gnu.org; 24 May 2020 14:28:47 +0000 Received: from localhost ([127.0.0.1]:38426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcrcE-0007r8-3w for submit@debbugs.gnu.org; Sun, 24 May 2020 10:28:47 -0400 Received: from lists.gnu.org ([209.51.188.17]:49932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcrcC-0007r1-Gv for submit@debbugs.gnu.org; Sun, 24 May 2020 10:28:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcrc8-0006or-Bq for bug-guix@gnu.org; Sun, 24 May 2020 10:28:35 -0400 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jcrc3-0007DN-21 for bug-guix@gnu.org; Sun, 24 May 2020 10:28:32 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1590330504; cv=none; d=zohomail.com; s=zohoarc; b=DnZhZ+d6uQgmEKLsiWy/Bm/d1Et3278gaTw9J5DtifwEUt08njHUPTUxR+urYVCnBPy/R5T+mTNjDA+bngQ7uMTD4engvhFFSh++sD+SWL9ixaZcD5/5juXaj/eYa3mmd5ximcJK0n7q5rfCXBFMAaDcgelQB0fqHG9wx3Iv8xI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590330504; h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To; bh=q8VRw/8F4DiJ44WNyarEs9XIDQXGRVT3mpZI2wghPPA=; b=KY5fo6AOUW/E9bGYDpadYBZhy3ssaeonCBFVwZQ/soG/KIaFoR7NjHAJvuFlXfKl5XTjD1P31du00n11ztwW5ButDwYNrIZvBbqMV2enOWM+hgCT6Sx+3DlU8rPZbIgxdcj3jhgYnBMrC1GbP3IrJvULYHGJZnPZe/WH6tyMttk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1590330504; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=q8VRw/8F4DiJ44WNyarEs9XIDQXGRVT3mpZI2wghPPA=; b=I6+klvHBn0N6HdX0bbUlqNquBBMaZCfARzOYxRPzgHrgcKw7HoN4BhOkxLukVrd8 wKQCPRjEY8crecFO5enwe+7Xrpjtsgg3bOrfX1MQvdCMXCK42zxjDBKH1TsRnl1sqg5 qqmAlc0iDsTS4CPHZUgcFWXNCmI1prWVFxPoeH4U= Received: from localhost (p54ad47fe.dip0.t-ipconnect.de [84.173.71.254]) by mx.zohomail.com with SMTPS id 1590330501617301.73975174022087; Sun, 24 May 2020 07:28:21 -0700 (PDT) User-agent: mu4e 1.4.4; emacs 26.3 From: Ricardo Wurmus To: bug-guix@gnu.org Subject: GHC retains references to Perl, GCC, and others X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Sun, 24 May 2020 16:28:18 +0200 Message-ID: <874ks5csql.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.53; envelope-from=rekado@elephly.net; helo=sender4-of-o53.zoho.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/24 10:28:25 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit 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: -2.3 (--) 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=E2=80=99s confi= gure 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 s= elf /gnu/store/x2rv5wz3d9z35p93sjv42gxs34y18ky3-ghc-8.6.5 1639.2 1= 358.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 s= elf /gnu/store/vdwkplh23jr54bg9mqvym26l8fv6x6kw-ghc-8.6.5 1862.1 1= 346.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/b= in/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--- --=20 Ricardo From debbugs-submit-bounces@debbugs.gnu.org Tue May 26 03:19:05 2020 Received: (at 41508) by debbugs.gnu.org; 26 May 2020 07:19:05 +0000 Received: from localhost ([127.0.0.1]:43864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdTrd-0005it-D9 for submit@debbugs.gnu.org; Tue, 26 May 2020 03:19:05 -0400 Received: from sender4-of-o52.zoho.com ([136.143.188.52]:21233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdTra-0005iT-Lh for 41508@debbugs.gnu.org; Tue, 26 May 2020 03:19:04 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1590476849; cv=none; d=zohomail.com; s=zohoarc; b=VI+0eYR0AJ3N0j9ZhHLDZeFSd9CZUhjSWeLtBqTMFq1ZXHY24LP2gvNnxCFcAIUBwstrp/VotTja2fOoMIsPsG0QvG4f/F2O8qNpDoDHNnqxePMaw8Otv+hDLhesX2b5+rfyAxMLsc28bqFUSln+SaNlsJIvXVV3qmUnduP/lQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590476849; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=wv3b+FQv7H2An/l9ZnkhHJl0amNtqBxDXtPu0h4SfDA=; b=Kli29oFurWCYVRcvocsVuweHDz75SpYkIT56it7+sLBnXX8IM8kMQRIx/EjomuyQ3mDpVZAdn8c3tKRfiJpHLkivc3HWwU3guG2szUremY0hTA+djr3qZcnhfJrjVqwiExUJkb9C35D5nLP6K54VTRckbOLSfOtK42SgcjpC18Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1590476849; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=wv3b+FQv7H2An/l9ZnkhHJl0amNtqBxDXtPu0h4SfDA=; b=WVW/f6OYUMZmsfxYGDg5LV/fcXGVzQ/tByghdOtClpYEl/r3fZu9a12ee9OPv8j2 lrTMjiOmS1mkcWRLgLOx61zOpvH9on8KFcRIOxOlCcpztaIp0QM6KS7okGVAzu2amoa BA/l9KdYKo66nDi1KXmZXRWMaAFqkbaeflNhmjXo= Received: from localhost (p54ad4c83.dip0.t-ipconnect.de [84.173.76.131]) by mx.zohomail.com with SMTPS id 1590476848061664.6994362168173; Tue, 26 May 2020 00:07:28 -0700 (PDT) References: <874ks5csql.fsf@elephly.net> User-agent: mu4e 1.4.4; emacs 26.3 From: Ricardo Wurmus To: 41508@debbugs.gnu.org Subject: Re: GHC retains references to Perl, GCC, and others In-reply-to: <874ks5csql.fsf@elephly.net> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Tue, 26 May 2020 09:07:24 +0200 Message-ID: <875zcjjhsj.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41508 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 (-) Ricardo Wurmus 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=E2=80=99s con= figure > 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 (=E2=80=9Cgcc=E2=80=9D instead of =E2=80=9C/gnu/s= tore/=E2=80=A6/bin/gcc=E2=80=9D, 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 =E2=80=9Csettings=E2=80=9D = 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. --=20 Ricardo