Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 626080

Summary: dev-lang/rust : build ignores -j1
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Gentoo Rust Project <rust>
Severity: normal CC: aleftmail, zeekec
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Toralf Förster gentoo-dev 2017-07-24 20:10:24 UTC
it ignores the -j1 from make.conf

# grep j /home/tinderbox/img1/13.0-desktop-plasma_20170716-133101/etc/portage/make.conf

  └─sudo,6565 /opt/tb/bin/ /home/tinderbox/img1/13.0-desktop-plasma_20170716-133101 /bin/bash /tmp/
      └─,6580 /opt/tb/bin/ /home/tinderbox/img1/13.0-desktop-plasma_20170716-133101 /bin/bash /tmp/
          └─su,6630 - root -c /bin/bash /tmp/
              └─bash,6720 /tmp/
                  └─emerge,3063 -b /usr/lib/python-exec/python3.4/emerge --update dev-lang/rust
                      └─sandbox,14040,portage /usr/lib/portage/python3.4/ compile
                          └─,14084 /usr/lib/portage/python3.4/ compile
                              └─,14109 /usr/lib/portage/python3.4/ compile
                                  └─python2.7,14127 build
                                      └─bootstrap,23329 build
                                          └─cmake,29840 --build . --target install --config Release -- -j 12
                                              └─gmake,29843 -j 12 install
                                                  └─gmake,29864 -f CMakeFiles/Makefile2 all
Comment 1 moxian 2017-09-04 04:06:40 UTC
Chiming in.
This is a big problem on memory-constrained system. Rust builds llvm as part of compilation, and linkage of llvm binaries takes ~3GB of RAM each.
With the default parallelism being set to the amount of cores available to the system, and no ability to change that, the compilation eats (on my 4-core system) 12GB. I have "only" 6GB of RAM, and compilation of rust makes the system swap a lot, rendering it effectively unusable for extended time (and, naturally, fails to emerge completely without enough swap on the system).

This will become a much more visible problem once www-client/firefox-52.3.0 with non-optional rust dependency gets unmasked.
Comment 2 moxian 2017-09-04 04:24:12 UTC
Actually, please disregard me.

It seems that the great memory use is due to -ggdb in my CFLAGS (, and without that one, the inability to control parallelism is still unpleasant but not as critical as I made it sound.
Comment 3 tt_1 2017-09-18 20:31:25 UTC
This is a massiv problem for arm, rpi2+3 for instance have quadcore arm cpu but only 1gb of ram. I added swap via usb hd but still this is not cool at all, torturing that poor hd :(
Comment 4 Toralf Förster gentoo-dev 2017-10-28 18:45:23 UTC
*** Bug 635696 has been marked as a duplicate of this bug. ***
Comment 5 Toralf Förster gentoo-dev 2017-10-28 18:49:56 UTC
seems, something like -C codegen-units=1 should go into the eclass ?
Comment 6 Toralf Förster gentoo-dev 2017-11-26 17:54:16 UTC
FWIW I tried
    RUSTFLAGS="-C codegen-units=1"
in make.conf, but that doesn't affect the build of rust itself :-/
Comment 7 Toralf Förster gentoo-dev 2017-11-26 18:51:01 UTC
From IRC upstream :

[19:48] <toralf> Is there any way to control the build of rust in that way that only 1 CPU is used ?
[19:48] <shep> frogmella: ?
[19:49] <shep> toralf: `cargo build --help` shows `    -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs`
[19:50] <frogmella> figured I would have to do something like that, thanks!
[19:50] <toralf> shep: ok, thx, so I just need a Gentoo dev who wrote that ebuild (
Comment 8 Toralf Förster gentoo-dev 2017-12-30 12:40:53 UTC

*** This bug has been marked as a duplicate of bug 613794 ***