Rust make system should respect -j1

8a52969
Opened by Toralf Förster at 2023-02-03 07:55:59

The build system seems not to respect -j1 for make (origin report is https://bugs.gentoo.org/613794) :

# /usr/bin/pstree -Ulnspua 1038
init,1         
  └─sudo,1026 /opt/tb/bin/chr.sh /home/tinderbox/run/17.0-no-multilib_libressl_20180124-193635 /bin/bash /tmp/job.sh
      └─chr.sh,1038 /opt/tb/bin/chr.sh /home/tinderbox/run/17.0-no-multilib_libressl_20180124-193635 /bin/bash /tmp/job.sh
          └─su,1113 - root -c /bin/bash /tmp/job.sh
              └─bash,1125 /tmp/job.sh
                  └─emerge,10956 -b /usr/lib/python-exec/python3.5/emerge --update dev-lang/rust
                      └─sandbox,7479,portage /usr/lib/portage/python3.5/ebuild.sh compile
                          └─ebuild.sh,7621 /usr/lib/portage/python3.5/ebuild.sh compile
                              └─ebuild.sh,7820 /usr/lib/portage/python3.5/ebuild.sh compile
                                  └─python2.7,7838 ./x.py build --verbose --config=/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/config.toml
                                      └─python2.7,7485 ./x.py build --verbose --config=/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/config.toml
                                          └─bootstrap,7486 build --verbose --config=/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/config.toml
                                              └─cmake,23604 --build . --target install --config Release -- -j 12
                                                  └─gmake,23616 -j 12 install
                                                      └─gmake,23742 -f CMakeFiles/Makefile2 all

Is there anything which can be improved in the Gentoo package definition or is this a rust issue ?

  1. It should work if you pass -j1 to the ./x.py invocation (process 7838).

    kennytm at 2018-01-27 17:38:13

  2. I seem to recall there being no way to determine what -j argument was passed to make in a program spawned by it.

    Mark Rousskov at 2018-01-28 16:35:20

  3. thx for the hint, https://613794.bugs.gentoo.org/attachment.cgi?id=517078 solved (at least a main fraction) of the issue) - from the sysstat I do run at my build bot I do still see some spikes in the CPU usage indicating 12 parallel processes while building rust but much less than before

    Toralf Förster at 2018-01-29 20:19:45

  4. Hm, that seems like a bug. If you can report on what those processes are (and ideally what spawned them) that would be nice; otherwise I'd presume that it won't get fixed soon unless someone else investigates.

    Mark Rousskov at 2018-01-31 23:24:10

  5. I seem to recall there being no way to determine what -j argument was passed to make in a program spawned by it.

    https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html#POSIX-Jobserver says the way to do this is by prefixing the commands in the makefile with + and parsing MAKEFLAGS. But that doesn't seem to be true in practice (maybe make is special-casing the make command?).

    That said, MAKEFLAGS is set to the args on the command line:

        print(env["MAKEFLAGS"])
    
     -j1
    

    so this should be possible to detect automatically I think.

    jyn at 2022-06-27 05:41:19

  6. cc https://github.com/rust-lang/rust/issues/95177

    jyn at 2023-02-03 07:55:59