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

Panu Matilainen pmatilai at laiskiainen.org
Tue Feb 11 07:09:42 UTC 2014


On 02/10/2014 10:41 PM, Robert P. J. Day wrote:
> 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. :-)

That'd be from your ~/.rpmmacros as set up by rpmdev-setuptree, not from 
rpm itself. The rationale is to detect parallel build problems in 
package makefiles on non-smp systems so the packager knows to avoid 
%{?_smp_mflags} with make in %build.

Note that the kernel build is known to work with parallel build, so the 
problems you're seeing are something else, such as subtly faulty 
components (cpu/memory/motherboard...) that trip up when pushed hard, or 
overheating.

	- Panu -


More information about the users mailing list