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