GNU bug report logs - #57788
[PATCH] gnu: rust: Disable debug info to reduce build requirements

Previous Next

Package: guix-patches;

Reported by: Mark H Weaver <mhw <at> netris.org>

Date: Tue, 13 Sep 2022 23:58:01 UTC

Severity: normal

Tags: patch

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57788 in the body.
You can then email your comments to 57788 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Tue, 13 Sep 2022 23:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mark H Weaver <mhw <at> netris.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 13 Sep 2022 23:58:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: rust: Disable debug info to reduce build requirements
Date: Tue, 13 Sep 2022 19:56:46 -0400
[Message part 1 (text/plain, inline)]
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.

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.

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

[0001-gnu-rust-Disable-debug-info-to-reduce-build-memory-r.patch (text/x-patch, inline)]
From 74a004295dc7bb6bdb20172aaf4778435bdf5832 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw <at> netris.org>
Date: Tue, 13 Sep 2022 19:28:03 -0400
Subject: [PATCH] gnu: rust: Disable debug info to reduce build memory
 requirements.

This dramatically reduces the memory required to build Rust, and also
speeds up the build.

* gnu/packages/patches/mrustc-disable-debug.patch: New file
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/rust.scm (%mrustc-source): Apply patch.
(rust-bootstrap, rust-1.55)[arguments]: In 'build' phase, set
CARGO_PROFILE_DEV_DEBUG environment variable to "false".
---
 gnu/local.mk                                  |   1 +
 .../patches/mrustc-disable-debug.patch        | 110 ++++++++++++++++++
 gnu/packages/rust.scm                         |   7 +-
 3 files changed, 117 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/mrustc-disable-debug.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cc96b77e03..a7f81ceda5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1521,6 +1521,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/monero-use-system-miniupnpc.patch			\
   %D%/packages/patches/mosaicatcher-unbundle-htslib.patch	\
   %D%/packages/patches/mrrescue-support-love-11.patch		\
+  %D%/packages/patches/mrustc-disable-debug.patch		\
   %D%/packages/patches/mrustc-riscv64-support.patch		\
   %D%/packages/patches/mtools-mformat-uninitialized.patch	\
   %D%/packages/patches/mupen64plus-ui-console-notice.patch	\
diff --git a/gnu/packages/patches/mrustc-disable-debug.patch b/gnu/packages/patches/mrustc-disable-debug.patch
new file mode 100644
index 0000000000..6458cecb31
--- /dev/null
+++ b/gnu/packages/patches/mrustc-disable-debug.patch
@@ -0,0 +1,110 @@
+diff -ru mrustc-0.10-orig/Makefile mrustc-0.10/Makefile
+--- mrustc-0.10-orig/Makefile	2022-09-13 07:49:26.299978699 -0400
++++ mrustc-0.10/Makefile	2022-09-13 07:52:19.243970927 -0400
+@@ -38,9 +38,9 @@
+ # - Disable deleting intermediate files
+ .SECONDARY:
+ 
+-LINKFLAGS := -g
++LINKFLAGS := 
+ LIBS := -lz
+-CXXFLAGS := -g -Wall
++CXXFLAGS := -Wall
+ CXXFLAGS += -std=c++14
+ #CXXFLAGS += -Wextra
+ CXXFLAGS += -O2
+diff -ru mrustc-0.10-orig/tools/common/Makefile mrustc-0.10/tools/common/Makefile
+--- mrustc-0.10-orig/tools/common/Makefile	2022-09-13 07:49:26.335978698 -0400
++++ mrustc-0.10/tools/common/Makefile	2022-09-13 07:50:58.243974567 -0400
+@@ -11,7 +11,7 @@
+ BIN := ../../bin/common_lib.a
+ OBJS = toml.o path.o debug.o
+ 
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++CXXFLAGS := -Wall -std=c++14 -O2
+ 
+ CXXFLAGS += $(CXXFLAGS_EXTRA)
+ 
+diff -ru mrustc-0.10-orig/tools/dump_hirfile/Makefile mrustc-0.10/tools/dump_hirfile/Makefile
+--- mrustc-0.10-orig/tools/dump_hirfile/Makefile	2022-09-13 07:49:26.335978698 -0400
++++ mrustc-0.10/tools/dump_hirfile/Makefile	2022-09-13 07:51:02.723974366 -0400
+@@ -15,7 +15,7 @@
+ OBJS := main.o
+ 
+ LINKFLAGS := -g -lpthread -lz
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++CXXFLAGS := -Wall -std=c++14 -O2
+ CXXFLAGS += -I ../common -I ../../src -I ../../src/include
+ 
+ CXXFLAGS += $(CXXFLAGS_EXTRA)
+diff -ru mrustc-0.10-orig/tools/minicargo/build.cpp mrustc-0.10/tools/minicargo/build.cpp
+--- mrustc-0.10-orig/tools/minicargo/build.cpp	2022-09-13 07:49:26.335978698 -0400
++++ mrustc-0.10/tools/minicargo/build.cpp	2022-09-13 07:47:19.567984395 -0400
+@@ -956,7 +956,7 @@
+             }
+         }
+     }
+-    if( true /*this->enable_debug*/ ) {
++    if( false /*this->enable_debug*/ ) {
+         args.push_back("-g");
+         args.push_back("--cfg"); args.push_back("debug_assertions");
+     }
+@@ -1106,7 +1106,7 @@
+     args.push_back("--crate-type"); args.push_back("bin");
+     args.push_back("-o"); args.push_back(outfile);
+     args.push_back("-L"); args.push_back(this->get_output_dir(true).str()); // NOTE: Forces `is_for_host` to true here.
+-    if( true )
++    if( false )
+     {
+         args.push_back("-g");
+     }
+diff -ru mrustc-0.10-orig/tools/minicargo/Makefile mrustc-0.10/tools/minicargo/Makefile
+--- mrustc-0.10-orig/tools/minicargo/Makefile	2022-09-13 07:49:26.335978698 -0400
++++ mrustc-0.10/tools/minicargo/Makefile	2022-09-13 07:51:07.011974173 -0400
+@@ -16,7 +16,7 @@
+ OBJS := main.o build.o manifest.o repository.o cfg.o
+ 
+ LINKFLAGS := -g -lpthread
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++CXXFLAGS := -Wall -std=c++14 -O2
+ CXXFLAGS += -I ../common
+ 
+ CXXFLAGS += $(CXXFLAGS_EXTRA)
+diff -ru mrustc-0.10-orig/tools/mir_opt_test/Makefile mrustc-0.10/tools/mir_opt_test/Makefile
+--- mrustc-0.10-orig/tools/mir_opt_test/Makefile	2022-09-13 07:49:26.339978698 -0400
++++ mrustc-0.10/tools/mir_opt_test/Makefile	2022-09-13 07:51:10.555974014 -0400
+@@ -15,7 +15,7 @@
+ LIBS := ../../bin/mrustc.a ../../bin/common_lib.a
+ 
+ LINKFLAGS := -g -lpthread -lz
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++CXXFLAGS := -Wall -std=c++14 -O2
+ CXXFLAGS += -I ../common -I ../../src/include -I ../../src -I .
+ CXXFLAGS += -Wno-misleading-indentation	# Gets REALLY confused by the TU_ARM macro
+ 
+diff -ru mrustc-0.10-orig/tools/standalone_miri/Makefile mrustc-0.10/tools/standalone_miri/Makefile
+--- mrustc-0.10-orig/tools/standalone_miri/Makefile	2022-09-13 07:49:26.339978698 -0400
++++ mrustc-0.10/tools/standalone_miri/Makefile	2022-09-13 07:51:14.731973826 -0400
+@@ -15,7 +15,7 @@
+ OBJS += miri.o miri_extern.o miri_intrinsic.o
+ 
+ LINKFLAGS := -g -lpthread
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++CXXFLAGS := -Wall -std=c++14 -O2
+ CXXFLAGS += -I ../common -I ../../src/include -I .
+ CXXFLAGS += -Wno-misleading-indentation	# Gets REALLY confused by the TU_ARM macro
+ 
+diff -ru mrustc-0.10-orig/tools/testrunner/Makefile mrustc-0.10/tools/testrunner/Makefile
+--- mrustc-0.10-orig/tools/testrunner/Makefile	2022-09-13 07:49:26.339978698 -0400
++++ mrustc-0.10/tools/testrunner/Makefile	2022-09-13 07:51:24.819973373 -0400
+@@ -5,8 +5,8 @@
+ BIN := ../../bin/testrunner
+ OBJS := main.o path.o
+ 
+-LINKFLAGS := -g
+-CXXFLAGS := -Wall -std=c++14 -g -O2
++LINKFLAGS := 
++CXXFLAGS := -Wall -std=c++14 -O2
+ 
+ CXXFLAGS += $(CXXFLAGS_EXTRA)
+ LINKFLAGS += $(LINKFLAGS_EXTRA)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 25295a283e..7d1b17ad5f 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -139,7 +139,8 @@ (define %mrustc-source
       (sha256
        (base32
         "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0"))
-      (patches (search-patches "mrustc-riscv64-support.patch")))))
+      (patches (search-patches "mrustc-riscv64-support.patch"
+                               "mrustc-disable-debug.patch")))))
 
 ;;; Rust 1.54 is special in that it is built with mrustc, which shortens the
 ;;; bootstrap path.
@@ -297,6 +298,8 @@ (define rust-bootstrap
                ;; to set the level of parallelism.
                (setenv "PARLEVEL" (number->string job-count))
                (setenv "CARGO_BUILD_JOBS" (number->string job-count))
+               ;; reduce memory requirements during the build
+               (setenv "CARGO_PROFILE_DEV_DEBUG" "false")
                (display "Building mrustc...\n")
                (apply invoke "make" make-flags)
 
@@ -453,6 +456,8 @@ (define rust-1.55
          (replace 'build
            ;; The standard library source location moved in this release.
            (lambda* (#:key parallel-build? #:allow-other-keys)
+             ;; reduce memory requirements during the build
+             (setenv "CARGO_PROFILE_DEV_DEBUG" "false")
              (let ((job-spec (string-append
                               "-j" (if parallel-build?
                                        (number->string (parallel-job-count))
-- 
2.37.1

[Message part 3 (text/plain, inline)]
-- 
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>.

Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Fri, 07 Oct 2022 10:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Fri, 7 Oct 2022 13:36:08 +0300
[Message part 1 (text/plain, inline)]
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? How much RAM+swap did you end up using with this
patch? I was going to point you to a patch upstream in mrustc but I
can't find it now, where they disabled debug builds by default, but I
can't find it now.

> 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.

> 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.


-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Fri, 07 Oct 2022 22:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Fri, 07 Oct 2022 18:04:24 -0400
Hi Efraim,

Efraim Flashner <efraim <at> flashner.co.il> 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 <https://stallmansupport.org>.




Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Sun, 09 Oct 2022 12:39:01 GMT) Full text and rfc822 format available.

Message #14 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mark H Weaver <mhw <at> netris.org>, 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Sun, 9 Oct 2022 15:38:40 +0300
[Message part 1 (text/plain, inline)]
On Fri, Oct 07, 2022 at 01:36:08PM +0300, Efraim Flashner wrote:
> On Tue, Sep 13, 2022 at 07:56:46PM -0400, Mark H Weaver wrote:
> 
> > 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.

To follow up, it brought the time to build rust-bootstrap aka 1.54, on
riscv64-linux down from ~56 hours to 13 hours.


-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Wed, 12 Oct 2022 10:49:02 GMT) Full text and rfc822 format available.

Message #17 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Wed, 12 Oct 2022 13:45:40 +0300
[Message part 1 (text/plain, inline)]
On Fri, Oct 07, 2022 at 06:04:24PM -0400, Mark H Weaver wrote:
> Hi Efraim,
> 
> Efraim Flashner <efraim <at> flashner.co.il> 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.

In my testing I didn't see a significant difference between using
CARGO_PROFILE_DEV_DEBUG, debug = false or both. My personal preference
would be to use CARGO_PROFILE_DEV_DEBUG for rust-bootstrap and then use
debug = false for the rest, since it keeps the config options together
in the config.toml file.

I did also experiment with parallel-compiler = 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.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Fri, 28 Oct 2022 10:42:02 GMT) Full text and rfc822 format available.

Message #20 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Fri, 28 Oct 2022 06:40:27 -0400
Hi Efraim,

I was surprised to see commit 01be1973f464cb81cdece54f7858f0dee46abb50
attributed solely to me, although I did not actually author that commit.

In the future, please do not attribute commits to me that I did not
write or approve of.  At minimum, if you modify a commit that I
proposed, please add a "Modified-by" line in the commit log.  If you
made radical changes to a commit that I proposed, better to list
yourself as author and maybe say "based on a proposal by Mark H Weaver"
in the commit log.

One important modification that got lost in your simplified commit was
the change I made to mrustc/tools/minicargo/build.cpp, which I evidently
found necessary.  Without that change, I do not know if Rust can still
be bootstrapped on a small machine such as mine.

Anyway, thanks for working on it, and for the other important work
you've done on dramatically shortening the Rust bootstrap.

      Regards,
        Mark

-- 
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>.




Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Sat, 29 Oct 2022 19:41:01 GMT) Full text and rfc822 format available.

Message #23 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Sat, 29 Oct 2022 22:39:59 +0300
[Message part 1 (text/plain, inline)]
On Fri, Oct 28, 2022 at 06:40:27AM -0400, Mark H Weaver wrote:
> Hi Efraim,
> 
> I was surprised to see commit 01be1973f464cb81cdece54f7858f0dee46abb50
> attributed solely to me, although I did not actually author that commit.
> 
> In the future, please do not attribute commits to me that I did not
> write or approve of.  At minimum, if you modify a commit that I
> proposed, please add a "Modified-by" line in the commit log.  If you
> made radical changes to a commit that I proposed, better to list
> yourself as author and maybe say "based on a proposal by Mark H Weaver"
> in the commit log.
> 
> One important modification that got lost in your simplified commit was
> the change I made to mrustc/tools/minicargo/build.cpp, which I evidently
> found necessary.  Without that change, I do not know if Rust can still
> be bootstrapped on a small machine such as mine.
> 
> Anyway, thanks for working on it, and for the other important work
> you've done on dramatically shortening the Rust bootstrap.
> 
>       Regards,
>         Mark

Sorry about that, I was modifying as I went and after updating mrustc to
a later commit the "if (true) add '-g'" spots in mrustc got changed to
depend on enabling debug, and I found that after removing -g from the
makefiles it wasn't being added anymore. I'll make sure to be more
careful in the future about commit attribution.

About mrustc/tools/minicargo/build.cpp, it looked to me like that was
specifically about building mrustc using the codeblocks IDE.

I've tried to rebuild rust-1.54 on my pine64, which has 2GB of ram and
4GB of swap and that didn't seem to be enough so I'm retrying that with
just 1 core. I'm also trying on my pinebook pro, with 4GB of ram and 6GB
of swap and I'll see if it works there or if it needs more tuning.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#57788; Package guix-patches. (Tue, 01 Nov 2022 05:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 57788 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 57788 <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Tue, 01 Nov 2022 01:11:02 -0400
Hi Efraim,

Efraim Flashner <efraim <at> flashner.co.il> writes:
> Sorry about that, I was modifying as I went and after updating mrustc to
> a later commit the "if (true) add '-g'" spots in mrustc got changed to
> depend on enabling debug, and I found that after removing -g from the
> makefiles it wasn't being added anymore.

Ah, so perhaps there's no longer any need to modify
mrustc/tools/minicargo/build.cpp.  So much the better!

> I'll make sure to be more careful in the future about commit
> attribution.

Thank you, Efraim.  I'm grateful to you for your work on this.

       Mark

-- 
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>.




Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Tue, 01 Nov 2022 05:15:01 GMT) Full text and rfc822 format available.

Notification sent to Mark H Weaver <mhw <at> netris.org>:
bug acknowledged by developer. (Tue, 01 Nov 2022 05:15:01 GMT) Full text and rfc822 format available.

Message #31 received at 57788-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: 57788-done <at> debbugs.gnu.org
Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce
 build requirements
Date: Tue, 01 Nov 2022 01:13:09 -0400
I'm closing this ticket now.

      Mark

-- 
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 29 Nov 2022 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.