can make -j be used for ports?

Matthias Andree matthias.andree at
Wed Mar 16 10:57:02 UTC 2011

Am 16.03.2011 03:38, schrieb John:
> On 15/03/2011 22:35, Eitan Adler wrote:
>> No, this is incorrect. The MAKE_JOBS_NUMBER and MAKE_JOBS_SAFE is used
>> internally when building a single port. When the OP is asking if he
>> can manually specify -j on the command line which would end up
>> building multiple ports in parallel. This can not be done (primarily
>> because there is no locking done on ports)
> Actually, he has it partially right, at least in the idea I was trying
> to convey. I'll explain again, because maybe I wasn't coherent enough
> previously:
> I have an amd x2 6000+ with 8GB RAM. It's a wonderful fast desktop. Not
> the fastest, but it's fast enough for me. What I want to do is this:
> 1. If I can speed things up, with *ports* as I have a dual cpu, I want
> to maybe run j2 or j3. I seek clarification which is logically best,
> because some literature says jn, others jn+1 where n is number of cores.
> kern.smp.cpus: 2 on my machine. Is there benefit setting this to 3,4,5?
> I want to know if there is perhaps a conf file or sysctl where I can
> specify this *for ports only.* - if not I'm happy to specify on the
> command line. It's just that the manual is a tad unclear about this.


MAKE_JOBS_NUMBER=3    # whatever you find useful.

The key is that you need to figure how loaded the CPU is.  As long as it 
is waiting for the disks (which it usually is), you can try to increase 
the number, but keep an eye on the RAM, you don't want the machine to go 
swapping in and out (although 8 GibiB are plenty).

On an i7-920 with a truckload of RAM I've sometimes even run make -j12 
or so (on Linux build jobs though) to actually get the CPU 100% busy.

> 2. Where I was being unclear I think is when I was talking about
> building the system. I have seen in the literature that -jn when
> installing world Breaks Things. This isn't an issue as I run RELEASE and
> so only either apply patches or make the system, so easy to specify,
> where I can, -j3 except in make installkernel and make installworld.

I've also found that "make -j4 -DNOCLEAN buildworld buildkernel" works 
for me on 8.2.  If RELENG_8 occasionally failed, I re-ran without 
-DNOCLEAN but still with -j4.  Looks like most of the issues with 
parallel building have been shaken out of the world :-)

Matthias Andree

More information about the freebsd-ports mailing list