Re: parallel building without make
Lucas Nussbaum wrote:
> On 29/01/08 at 17:23 -0300, Felipe Sateler wrote:
>> Recently dpkg-buildpackage got the option to build in parallel via the -j
>> option. This means that debian/rules is called with that option set, and sets
>> parallel=n in DEB_BUILD_OPTIONS.
>> The problem is that for build systems not using make (eg, scons), this option
>> is not inherited. Of course, one could parse DEB_BUILD_OPTIONS and find if
>> parallel=n is set and then call the build system with the equivalent option.
>> However this means that, although one specified n threads of execution, there
>> can be more than n threads concurrently. Consider this case:
>> build: build-indep build-arch
>> scons -j$(NTHREADS) buildProgram
>> scons -j$(NTHREADS) buildDocumentation
>> Where NTHREADS is calculated from DEB_BUILD_OPTIONS. If I call
>> dpkg-buildpackage with -j2, I will get build-arch and build-indep running
>> concurrently, which means I will actually get 4 scons threads running instead
>> of the intended 2.
>> What should I do? I see 3 options:
>> 1- Don't use the -j flag in scons
>> 2- Use the -j flag and potentially use more threads than specified
>> 3- Use the -j flag with a lower number (eg, NTHREADS/2).
>> Any opinions?
> Don't use dpkg-buildpackage -j. Only set DEB_BUILD_OPTIONS="parallel=n",
> so build-arch and build-indep are not run in parallel, but you still get
> several scons threads.
OK. But it makes me wonder what is the real use for -j in dpkg-buildpackage,