Stream: general

Topic: Resources required to build rustc


ange (Jan 22 2019 at 13:36, on Zulip):

Is there some estimate on how much memory and disk space one needs in order to build e.g. a stage1 rustc? The only reference I could find only talks about 3GB being insufficient

ange (Jan 22 2019 at 13:37, on Zulip):

FWIW, I rustc OOM'd for me at Killed process 1211 (rustc) total-vm:9055808kB, anon-rss:6715044kB, file-rss:0kB, shmem-rss:0kB on an amd64 system

ange (Jan 22 2019 at 13:38, on Zulip):

I guess the reason I'm asking is in case I'm doing something wrong (e.g. not setting some option in config.toml)

nagisa (Jan 22 2019 at 13:44, on Zulip):

I’ve seen rustc build take upwards of 10GB with LTO enabled.

ange (Jan 22 2019 at 13:46, on Zulip):

@nagisa, thanks, that's very helpful. I'll try with thin-lto then

ange (Jan 22 2019 at 14:29, on Zulip):

OK, so I realized that the thin-lto option in config.toml applies to the llvm build. So I'm not really sure if there's anything else I can tweak?

QuietMisdreavus (Jan 22 2019 at 14:32, on Zulip):

when i had problems building rustc on a low-spec server, i had some luck with turning down the number of codegen units and turning off debuginfo

QuietMisdreavus (Jan 22 2019 at 14:34, on Zulip):

those should all be off by default tho, so i dunno what else to suggest :/

ange (Jan 22 2019 at 14:35, on Zulip):

@QuietMisdreavus well I have enabled debuginfo, but that's kind of a requirement, no? (I want to look at an ICE)

QuietMisdreavus (Jan 22 2019 at 14:35, on Zulip):

yeah, without debuginfo that gets a lot harder

nagisa (Jan 22 2019 at 14:39, on Zulip):

debug info will definitely make your memory requirements for a build a dozen or so times larger.

nagisa (Jan 22 2019 at 14:39, on Zulip):

you may have some success by using the lld linker

ange (Jan 22 2019 at 14:42, on Zulip):

@nagisa I tried setting target.x86_64-unknown-linux-gnu.linker to lld, but then I got compilation errors in libc, as the build clearly expected a compiler interface there (-Wl,). switched to using linker = clang which I'm not sure that it uses lld on my distro

nagisa (Jan 22 2019 at 14:43, on Zulip):

You want [rust.lld].

nagisa (Jan 22 2019 at 14:43, on Zulip):

(there should be a line commented out that says lld = false or something)

ange (Jan 22 2019 at 14:44, on Zulip):

ah, indeed, thanks

ange (Jan 23 2019 at 11:19, on Zulip):

OK, so, for anyone searching for this info in the future: with debuginfo and 'lld = true', peak RSS was ~1.4GB and the resulting build directory is 11+GB

ange (Jan 23 2019 at 11:19, on Zulip):

that is for stage1 only (./x.py build -i --stage 1 src/libstd)

ange (Jan 23 2019 at 11:19, on Zulip):

Should maybe add this to the rustc guide somewhere

ange (Jan 23 2019 at 11:20, on Zulip):

I'll do a rebuild from scratch at some point to verify the numbers and then hopefully send a PR

Last update: Nov 21 2019 at 23:30UTC