[Slackbuilds-users] Feature request: add $NUMJOBS to SBo build scripts

Jeremy Hansen jebrhansen+SBo at gmail.com
Thu Jul 25 14:09:50 UTC 2019


On Thu, Jul 25, 2019, 7:56 AM Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
wrote:

> On 2019-07-24, Jeremy Hansen <jebrhansen at gmail.com> wrote:
> > To go along with Kyle's suggestion, I set my MAKEFLAGS with a file in
> > /etc/profile.d/ directory (I call it make-export.sh), so it is
> > automatically applied when any user logs in.
> >
> > The following will set MAKEFLAGS to the number of CPU threads + 1 (it
> says
> > cores, but Linux the number of threads the CPU is capable of as
> individual
> > cores).
> >
> > jbhansen at craven-moorhead:~$ cat /etc/profile.d/make-export.sh
> > #!/bin/bash
> >
> > # Set make jobs to default to num cores + 1
> > export MAKEFLAGS="-j$(expr $(nproc) + 1)"
>
> -j$(nproc) is very useful itself in most cases as it can speed up the
> build build considerably but still I think it should be used with
> caution and don't be set globally.  For example, at my current $JOB
> I've worked with sloppily written Makefile written by people from
> another company that did some crazy things such as extracting tarballs
> and the build process failed when -j was used.  Also, a couple of
> months ago I tried to build llvm with -j$(nproc) and it also failed
> but I don't remember the specific reason but it was something like
> this:
>
> https://stackoverflow.com/questions/25197570/llvm-clang-compile-error-with-memory-exhausted
> .
> --
> Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
>

Yes, there's always the possibility of having multiple jobs cause a
failure, but in those cases, you can simply override it by running
MAKEFLAGS="-j1" sh some.SlackBuild. In all the SlackBuilds I've run, I
think I've only needed to override the number of jobs less than 5 times.
For me, it was well worth the increased speed of compiling. But maybe it
isn't for everyone.

Jeremy

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20190725/9ade7089/attachment.htm>


More information about the SlackBuilds-users mailing list