how can i tell rpmbuild to *not* parallelize make during the build?

Rick Stevens ricks at alldigital.com
Mon Feb 10 21:08:37 UTC 2014


On 02/10/2014 12:41 PM, Robert P. J. Day issued this missive:
> On Mon, 10 Feb 2014, Rick Stevens wrote:
>
>> On 02/10/2014 12:09 PM, Robert P. J. Day issued this missive:
>>>
>>>     grrrrrr ... following the instructions here:
>>>
>>> https://fedoraproject.org/wiki/Building_a_custom_kernel
>>>
>>> on how to build a custom kernel (some of which is incorrect, more on
>>> that later), and builds keep failing at random places, i'm guessing
>>> because i have a hyperthreaded quad-core laptop, and the "make -j8" is
>>> simply tripping over itself in arbitrary places.
>>>
>>>     what's the easiest way to specify a single-threaded build? yes, it
>>> will take forever, but it will be nice to verify that that's the
>>> problem.
>>>
>>>     thanks.
>>>
>>> rday
>>
>> Theoretically you could do
>>
>> 	MAKEFLAGS="-j 1" rpmbuild blah-blah
>>
>> gmake looks for the environment variable "MAKEFLAGS". Most reasonable
>> makefiles do "MAKEFLAGS+=other-specific-flags", so it should honor it.
>> Keep in mind that if there are multiple "-j" variables to gmake, it will
>> only honor the LAST one specified. YMMV.
>
>    well, this is interesting ... i found the variable "smp_mflags" in
> kernel.spec, so i ran:
>
>    $ rpmbuild --showrc
>
> to see how it was being set, and found the following:
>
> -14: _smp_mflags        %(
>      [ -z "$RPM_BUILD_NCPUS" ] \
>          && RPM_BUILD_NCPUS="`/usr/bin/nproc 2>/dev/null || \
>                               /usr/bin/getconf _NPROCESSORS_ONLN`"; \
>      if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then \
>          echo "-j16"; \
>      elif [ "$RPM_BUILD_NCPUS" -gt 3 ]; then \
>          echo "-j$RPM_BUILD_NCPUS"; \
>      else \
>          echo "-j3"; \
>      fi )
>
> which i find fascinating since, if you follow the logic, even if you
> use "RPM_BUILD_NCPUS=1", that code above will still set it to 3. :-)

Indeed. I was going to suggest that it was buried in an rc file. I
believe you'll find that in /usr/lib/rpm/platform/<arch>-linux/macros
or possibly /usr/lib/rpm/redhat/macros. You could override it there if
you want. However, I suspect there may be something else going on.
Parallel builds don't generally poop out. There may be a race going on,
but you might want to check your RAM, too.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-        Change is inevitable, except from a vending machine.        -
----------------------------------------------------------------------


More information about the users mailing list