From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id Uk0eFalF415uVgAA0tVLHw (envelope-from ) for ; Fri, 12 Jun 2020 09:06:49 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MDmkEKlF417+IQAAB5/wlQ (envelope-from ) for ; Fri, 12 Jun 2020 09:06:49 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B8CB09404CF for ; Fri, 12 Jun 2020 09:06:48 +0000 (UTC) Received: from localhost ([::1]:35240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjfeB-0004eJ-8m for larch@yhetil.org; Fri, 12 Jun 2020 05:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjfe1-0004do-KD for guix-devel@gnu.org; Fri, 12 Jun 2020 05:06:37 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjfdz-0000pV-IA for guix-devel@gnu.org; Fri, 12 Jun 2020 05:06:37 -0400 X-Originating-IP: 92.169.129.147 Received: from bababa (lfbn-idf2-1-1315-147.w92-169.abo.wanadoo.fr [92.169.129.147]) (Authenticated sender: mail@ambrevar.xyz) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 992AAFF806 for ; Fri, 12 Jun 2020 09:06:32 +0000 (UTC) From: Pierre Neidhardt To: guix-devel@gnu.org Subject: Reducing LLVM closure size Date: Fri, 12 Jun 2020 11:06:32 +0200 Message-ID: <87d064slev.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=217.70.183.199; envelope-from=mail@ambrevar.xyz; helo=relay9-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 05:06:33 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=1, FROM_SUSPICIOUS_NTLD_FP=1, PDS_OTHER_BAD_TLD=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: 0.89 X-TUID: tk+zpZ0Erwch --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Since LLVM is all over the place, _multiple_ versions of LLVM inevitably end up in anyone's graph. Can we reduce its closure size? =2D-8<---------------cut here---------------start------------->8--- > guix size llvm store item total s= elf /gnu/store/118xpdazyylxa1rlc68h9lmh38vhxrb4-llvm-10.0.0 210.8 = 139.3 66.1% /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 38.4 = 36.7 17.4% /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib 71.0 = 32.6 15.5% /gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16 1.6 = 1.6 0.8% /gnu/store/rykm237xkmq7rl1p0nwass01p090p88x-zlib-1.2.11 71.2 = 0.2 0.1% /gnu/store/bw15z9kh9c65ycc2vbhl2izwfwfva7p1-libffi-3.3 71.2 = 0.2 0.1% total: 210.8 MiB =2D-8<---------------cut here---------------end--------------->8--- Let's look at what Arch Linux does: =2D https://www.archlinux.org/packages/extra/x86_64/llvm/ =2D https://www.archlinux.org/packages/extra/x86_64/llvm-libs/ =2D https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h= =3Dpackages/llvm For the first 2 links, click on "View the file list for ..." link at the bottom to display the file list. "bin" and "include" occupy some 35 MiB. First thing we can do is split =2D either move the libs to a "lib" output, =2D or move the "bin" and "include" folder to a new output. The second approach has the benefit of being less disruptive for dependents. Now if we look at the PKGBUILD, there are some interesting compilation flags. If we remove "-DBUILD_SHARED_LIBS:BOOL=3DTRUE" and add "-DLLVM_BUILD_LLVM_DYLIB=3DON" "-DLLVM_LINK_LLVM_DYLIB=3DON" it will produce a single libLLVM-10.so library. This reduces the "lib" folder size from 107 MiB to 90 MiB. All in all, it looks like we can save 52 MiB out of 140 MiB from the LLVM package (and 210 MiB from its closure). This would need a bit of testing since LLVM has many versions and many dependents (a change to llvm-3 rebuilds 1000+ dependents). By the way, this looks like a bug: =2D-8<---------------cut here---------------start------------->8--- > guix refresh -l llvm Building the following package would ensure 3 dependent packages are rebuil= t: clang-toolchain@10.0.0 =2D-8<---------------cut here---------------end--------------->8--- Why is only 1 package displayed? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7jRZgACgkQm9z0l6S7 zH9vZAf/VbsC9btn5nmv39Qs5LE2+bhZ15C8gvpEOl61Keln7pFF/W+IpVCGSfZg 6ZEQcmznSlASrhkeMP8tvE8IOTJWTM4JhwgNSNZ5K5lU7KZ6lvACB1wthFLwa17B VN7BvfBREUfDhV1+8lm33Lt0JWXOT+6ntLwYgoNZgjUicTBKFxkcjbqxMV5EXuOp UbeTWZy5bErHzH3ZUWq8p6fZUhmjwiyVoGAu/avhbax2SkDfTiuP73J22OkGaIE9 eUHFHIP/k6vJZZvOAvtn4VGXEVDVc8V+TaZ4QkNR44QpgaH5rh3XjS2Hy1da0WM4 AgYMP4v3CbcKRH1MhrHrUtfUOC1JoA== =ta9P -----END PGP SIGNATURE----- --=-=-=--