From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0D/MFOiiQGPPwQAAbAwnHQ (envelope-from ) for ; Sat, 08 Oct 2022 00:06:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 4JveE+iiQGNPrwAAG6o9tA (envelope-from ) for ; Sat, 08 Oct 2022 00:06:32 +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 E5B5F1141E for ; Sat, 8 Oct 2022 00:06:31 +0200 (CEST) Received: from localhost ([::1]:49032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogvUF-0003Oh-3K for larch@yhetil.org; Fri, 07 Oct 2022 18:06:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogvTm-0003OR-Vl for guix-patches@gnu.org; Fri, 07 Oct 2022 18:06:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogvTm-0003vp-2o for guix-patches@gnu.org; Fri, 07 Oct 2022 18:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ogvTl-0001iw-ME for guix-patches@gnu.org; Fri, 07 Oct 2022 18:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce build requirements Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 07 Oct 2022 22:06:01 +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: Efraim Flashner Cc: 57788@debbugs.gnu.org Received: via spool by 57788-submit@debbugs.gnu.org id=B57788.16651803376592 (code B ref 57788); Fri, 07 Oct 2022 22:06:01 +0000 Received: (at 57788) by debbugs.gnu.org; 7 Oct 2022 22:05:37 +0000 Received: from localhost ([127.0.0.1]:37619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogvTM-0001iG-RR for submit@debbugs.gnu.org; Fri, 07 Oct 2022 18:05:37 -0400 Received: from world.peace.net ([64.112.178.59]:35682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogvTK-0001i3-VM for 57788@debbugs.gnu.org; Fri, 07 Oct 2022 18:05:35 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogvTD-0003r1-HA; Fri, 07 Oct 2022 18:05:27 -0400 From: Mark H Weaver In-Reply-To: References: <874jxahlpi.fsf@netris.org> Date: Fri, 07 Oct 2022 18:04:24 -0400 Message-ID: <877d1buw70.fsf@netris.org> MIME-Version: 1.0 Content-Type: text/plain 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=1665180391; 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; bh=b/LSuN6Lg3XCXmWtTkf3WQMHusHExdpFI1DIG5ywhfo=; b=O9d58rUXMX4NkWm9YSnHxvrt7alR4l60t/l3q3Yr2nJzLg59JNnv8vvMoF7mzy6bStwwF+ 3x8nXBScQGq0QAvKyORKnU7pYeFsZ59IXIvY8RWJYuUIAOyIe3ZL91SYaqjmzLw74tqWCV WSyG/+WUTsQVUzAb6707aq5poluVNzpj2oFO7VHucwu39nijrex5eBBiqpzcO2rGXpI6pE DN6bKwZAH1MnQIgfPpxDcQsFmy2WCTQS3Tu6OYBrWowxi1ze5a2qAjPI0QqUDDbW+BNky/ FhwoZFtMjalBOR4i5Ya4/FBqGgyVHDdQzdXzP1GQjONx7bjd58yZBa7m/MzR0w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665180391; a=rsa-sha256; cv=none; b=oef9A62oevQ8RTvLgUEvsS2s6chbtGq5dBVQVUwCY9OxTkqWUIQ6c98FzWcxAtcpWBMKEv VvGVRj9+mMxjZ5XpOT8ezcfHpQ/hdNwgN6eg6jRobuCOp51DP71ytUIhdOIEmTgxweiu11 RjZVQIIq3zFVNQbQiXlBE5Go9d6UVjq2docXwR2QB0Etl3WNyT4JPGswLBksIfwXIP7Us6 91VSS8fGGlGE7vfSexZZ70TCXRMaMMINs/n7wbTCKZWIOnE4GPw0tdqD7fg9MVYaDn8emY /+Z8qFQW9VAHFBx/IwRhJ8rVgrrSHuD3cIvtxtmuCDSlt1ipQHqj1NIV5RxNpg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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: -2.88 Authentication-Results: aspmx1.migadu.com; dkim=none; 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: E5B5F1141E X-Spam-Score: -2.88 X-Migadu-Scanner: scn1.migadu.com X-TUID: saySr8stu7F6 Hi Efraim, Efraim Flashner writes: > 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. >> >> 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 Rust >> 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 heavy >> thrashing before the OOM killer finally put it out of its misery. > > Your x200 is an x86_64? Yes, with only 4 GB of RAM. > How much RAM+swap did you end up using with this patch? 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. >> 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. 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 :-) >> 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 old >> 'master' (April 2021) and is thus quite different by now. >> >> I offer it here in case it might be of interest, although it hasn't been >> 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. >> >> 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. After writing my previous message, I ended up adding another hunk to my patch, to disable debugging in the final 'rust' compiler: --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 =.*" all) (string-append all "gdb = \"" 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 = false\n"))))) (replace 'build ;; Phase overridden to also build rustfmt. (lambda* (#:key parallel-build? #:allow-other-keys) --8<---------------cut here---------------end--------------->8--- In retrospect, for the post-mrustc compilers, it might have been sufficient to add "debug = 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. Thanks for working on it, Efraim! Regards, Mark -- Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about .