From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8GHOB9abRmP3yAAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 12:49:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gBnrB9abRmMHcgAA9RJhRA (envelope-from ) for ; Wed, 12 Oct 2022 12:49:58 +0200 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 8FF111FCE2 for ; Wed, 12 Oct 2022 12:49:57 +0200 (CEST) Received: from localhost ([::1]:53802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiZJC-00051Q-Kz for larch@yhetil.org; Wed, 12 Oct 2022 06:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiZIN-0004xn-M6 for guix-patches@gnu.org; Wed, 12 Oct 2022 06:49:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiZIN-0008Em-BB for guix-patches@gnu.org; Wed, 12 Oct 2022 06:49:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiZIM-0007mK-4k for guix-patches@gnu.org; Wed, 12 Oct 2022 06:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce build requirements Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 Oct 2022 10:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mark H Weaver Cc: 57788@debbugs.gnu.org Received: via spool by 57788-submit@debbugs.gnu.org id=B57788.166557174029893 (code B ref 57788); Wed, 12 Oct 2022 10:49:02 +0000 Received: (at 57788) by debbugs.gnu.org; 12 Oct 2022 10:49:00 +0000 Received: from localhost ([127.0.0.1]:55826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiZIJ-0007m4-OZ for submit@debbugs.gnu.org; Wed, 12 Oct 2022 06:49:00 -0400 Received: from mail-ej1-f49.google.com ([209.85.218.49]:41764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiZII-0007ls-6X for 57788@debbugs.gnu.org; Wed, 12 Oct 2022 06:48:58 -0400 Received: by mail-ej1-f49.google.com with SMTP id qw20so36528967ejc.8 for <57788@debbugs.gnu.org>; Wed, 12 Oct 2022 03:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=mOSIG64SoXj/na7N8Q+oeR3dnh83EAM8owAWTRvyaks=; b=Fp2MzGPGIaGxSOban+aac7IdgCvJvJdEtRFR4Uuhlw2xBfiyTGysBM0EWDH6kPuFa1 URbnaZMVbQ76j1EPU19cvNoAtvCH/rse9Hf9FmTuS85tNNJE2OKw8owuiX1QUPWev380 9uTnBnlpuQNCLFdECf8h4hypJeUxNgzW0cJU8hqnP+RmwfZfDA2ylMqjA04itJfFBWXm qxPBD5B3mUnzdGqqTs6x8HHK2MP1sZWm+q9NWZiLSfhOyiPA5SR3/9r4uTEUIhjgNxSi GRPdpabYtZt/Wu3uos1+f3wBg5qd7SwK+1W5EsY6eNt/twuiKXc4nYWdvFOhi12CXDBY ysaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mOSIG64SoXj/na7N8Q+oeR3dnh83EAM8owAWTRvyaks=; b=zqSzhYmMPrL9GITRRApbiZc6jAVB42F9GOhZk4hVi1mbiQHiaEJgv26sIQKPvzsLnq El5kqqvXo9BJg/FHEXwa9YWNhxVJGJk13XRYEbBTxbest2LGYkUloRosAloJUx3cxxub rMlnosJf0AP1Hzqmsk6m8ND5i9H+b8JJsBrq2p1qC9cK8Z4ZDj0sZAMWVBTJpQdB8NjB rVCvECiYrblylSxH7nen/txkMeV4xtXd2WKZpheN4XtBgc/XoliIWz+VoXvzFd5z8d+o WqU8ZnyZKb4qdcL/nLF2sn/ol7NroX5Clfd7TTrjLBoTH4uEy+clvg39ptv4mDVr2nhL L2PQ== X-Gm-Message-State: ACrzQf3OoEy/PZMbmLwCB179H2UaVslELx7mW8J/ZT4u4XwWEl4QBtGr 3/PngkabppjdLY/Z1gcH1V8= X-Google-Smtp-Source: AMsMyM6/k4ms9P2j8dsiDjqvxhYOc9qrIAXNZKBLFW5Ap+GPfqKeA3ZHFRUF540KBMNWOyA8qgxjBw== X-Received: by 2002:a17:907:d8e:b0:783:a4f0:1052 with SMTP id go14-20020a1709070d8e00b00783a4f01052mr22119449ejc.41.1665571731898; Wed, 12 Oct 2022 03:48:51 -0700 (PDT) Received: from localhost ([141.226.13.62]) by smtp.gmail.com with ESMTPSA id w5-20020a056402128500b004589da5e5cesm10977815edv.41.2022.10.12.03.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 03:48:51 -0700 (PDT) Date: Wed, 12 Oct 2022 13:45:40 +0300 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Mark H Weaver , 57788@debbugs.gnu.org References: <874jxahlpi.fsf@netris.org> <877d1buw70.fsf@netris.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9WpP0ae1Yb/fFjUB" Content-Disposition: inline In-Reply-To: <877d1buw70.fsf@netris.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665571797; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=mOSIG64SoXj/na7N8Q+oeR3dnh83EAM8owAWTRvyaks=; b=RX3SRcnI+3gShY+X/PCFXmBV1VIPJpjokC+deUW2e127nPKwT1jF83OJ5RKspMQlDMbv61 qXWyKwrdxTYwMGLgflP7nrly4C7g/dAVxpMKGtoEkFLV8Wc51MKtbo+fm6RJ2o6NB6rY1R ujEX/PpEwYwYQ5XaDRafcZOgku82JGBsPUzeEsvQysiCuPBJyneGRh94vJhbVK1TJdOpFv ATZCU1bpl/w2ORXw4YMAhvwcmN9yy0Izc07eeiE7T1zZiwJBdgwvvxI6LXlXzLQPGizdzU q9ex3KagFKv+W9SYEYNjLKsgJBZA3Qb4nIH2xdPtaHKQgdNIAwO+J52QIidcCQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665571797; a=rsa-sha256; cv=none; b=sLY7Efqf/oPLPm6lE5ufbOZQFJFok04nEL8bcqjql1mTlQjJL8eOK/wzV/AOW+byM/mmjy A6AAV0adHb1bbGubs7vFZiAfnKyvZxjANliy3WJ2BTyPx19vJ1i1bDoS8vYG+CNHWvKouy XrhpyPnI/lm44/Kkqo/bHptescnhnDLxAjrUfHY+E7MfdnEHE6agbzKZflCineA3RlY6VG TjIlRtAj6UGtU2KbKZzUu9ap6aVhGMLiul4rJcqYuVAUEpDjHejDm7ZjaFTxx7CI077NJM /QbhWxfbQWnYB+YVLTCVpnRLD6TeShxRsBCmFEaZgxZCPul5VTuAGpXL0zyVgw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Fp2MzGPG; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.50 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Fp2MzGPG; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8FF111FCE2 X-Spam-Score: -0.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: 8LjrO3ayWibf --9WpP0ae1Yb/fFjUB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 07, 2022 at 06:04:24PM -0400, Mark H Weaver wrote: > Hi Efraim, >=20 > Efraim Flashner writes: >=20 > > On Tue, Sep 13, 2022 at 07:56:46PM -0400, Mark H Weaver wrote: > >> The following patch, which I've tested only on my private branch of > >> Guix, dramatically reduces the amount of memory and time required to > >> build Rust. > >>=20 > >> With this patch applied, I'm able to build Rust on a Thinkpad X200 with > >> only 4 GB of RAM using both cores. Without it, I'm unable to build Ru= st > >> at all, even with parallel builds disabled, running in a bare text-only > >> terminal, and with every nonessential daemon stopped. When I tried, a > >> single compiler process used more than 9 GB of virtual memory with hea= vy > >> thrashing before the OOM killer finally put it out of its misery. > > > > Your x200 is an x86_64? >=20 > Yes, with only 4 GB of RAM. >=20 > > How much RAM+swap did you end up using with this patch? >=20 > During the times when I was monitoring it, the build process with > parallel build enabled (2 parallel jobs) fit entirely within my 4 GB of > RAM, while also running a modest X session with Emacs. >=20 > >> Moreover, with this patch the builds are dramatically faster than I've > >> previously observed. In my earlier bootstraps of Rust (up to > >> rust-1.51), it took about 5 hours to build each compiler on my machine. > >> Now it takes only about 2 hours per compiler, except for the initial > >> bootstrap (1.54) which takes about 4 hours. > > > > I tested it out on my machine, it brought the build time down from 101 > > minutes to 71 minutes. Not the same improvement, but still noticeable. >=20 > I'm glad to hear it! I guess the improvement was more dramatic on my > system because it was previously thrashing (lots of swapping due to > insufficient RAM), whereas your system probably has enough RAM :-) >=20 > >> The following patch is meant to be applied to the 'staging' branch, but > >> I've only tested it on my own private branch, which is based on very o= ld > >> 'master' (April 2021) and is thus quite different by now. > >>=20 > >> I offer it here in case it might be of interest, although it hasn't be= en > >> tested on contemporary Guix. I'm not subscribed to this mailing list, > >> so please make sure to CC me on any replies you'd like me to see. > >>=20 > >> Regards, > >> Mark > > > > I'm building out to librsvg on staging right now with this patch > > applied, so hopefully we'll see that it's good. > > > > I'm assuming that setting CARGO_PROFILE_DEV_DEBUG to false won't cause > > any problems. >=20 > After writing my previous message, I ended up adding another hunk to my > patch, to disable debugging in the final 'rust' compiler: >=20 > --8<---------------cut here---------------start------------->8--- > diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm > index 25295a283e..cf2c66f334 100644 > --- a/gnu/packages/rust.scm > +++ b/gnu/packages/rust.scm > @@ -704,6 +704,13 @@ (define-public rust > (("^python =3D.*" all) > (string-append all > "gdb =3D \"" gdb "/bin/gdb\"\n"))))= )) > + (add-before 'build 'disable-debug > + (lambda _ > + ;; reduce memory requirements during the build > + (setenv "CARGO_PROFILE_DEV_DEBUG" "false") > + (substitute* "config.toml" > + (("\\[rust\\].*" all) > + (string-append all "debug =3D false\n"))))) > (replace 'build > ;; Phase overridden to also build rustfmt. > (lambda* (#:key parallel-build? #:allow-other-keys) > --8<---------------cut here---------------end--------------->8--- >=20 > In retrospect, for the post-mrustc compilers, it might have been > sufficient to add "debug =3D false" to the [rust] section of config.toml > in the 'rust-1.55' variable. This might also eliminate the need to set > CARGO_PROFILE_DEV_DEBUG. However, I haven't tried it. In my testing I didn't see a significant difference between using CARGO_PROFILE_DEV_DEBUG, debug =3D false or both. My personal preference would be to use CARGO_PROFILE_DEV_DEBUG for rust-bootstrap and then use debug =3D false for the rest, since it keeps the config options together in the config.toml file. I did also experiment with parallel-compiler =3D true to build a multithreaded rustc but I wasn't able to prevent the test suite for rust-1.60 to not error out. I also tried skipping the tests for rust itself and compiling librsvg with it, but they were serious when they said it wasn't ready. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --9WpP0ae1Yb/fFjUB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmNGmtAACgkQQarn3Mo9 g1Hp1RAAwfjunekYmjfWwhGmym09jN9dfFFCBeIKAoLSgtG1nXPTnK6Q9F5uL/wf DJYnu376yK2H5XPm3Fy5bEMDcDOEqeRu2g+YGGECkZP9Mv7/f/4X0mScXRJMZxoo vEQeUJxd45FIE5L8UouOUdH09ZLE2/QBD9a6WELKD0XvHR5jn3h6H7KOT4uNe4fI HEFE+0ZCxQrAyv50noR5Ij6XMyJmPq4iPdBaeIVFW80Y9ol604kQcF0yweMigL5G m6/JIhFny9Apn5rT0eFzlYXkmfhyIdlx2snmS3rBn9hsHaLP9g3knrnzEzNjbQaU t2APePK6wnQdCq9n2zfAGpz2S6lEGLgySrhXsRsxIzquuPcbo26B5BUMvMU9D5ys odqhp0bhhcUIvsz5yQT4eBScv5W5VlJu0e8TQ25G14hZhuiii6caOi+GiWv/63Uc 5PpWkRntJCZFEcSu95CXo9vUttaWBVgEZU2M9En7wU23fgU2e5mPMmr6LQX5yx6s V29YengcoD+qelK4HdN55lhxPmga+jaZIDB3n1koniKeeOFg/RBuW3u5lc1+ufbo PeMfAEmbOToeUN7N6rL/5w7IFXU/w6RNbXPmLzHr0os3KeYmbNa4TCVY+FdQ8R+6 WNRNIT5eOvGWo+OWYOhlCpA/QKfSgD1veXHpF5dHpm2KyXsRYpw= =+BVo -----END PGP SIGNATURE----- --9WpP0ae1Yb/fFjUB--