Solved How to *actually* compile with multiple threads?

I just installed FreeBSD 16.0-CURRENT on my PC, and am currently building the NodeJS port. However, because it's such a large port, compiling it in a single thread is obnoxiously slow. How do I fix that?
I've tried setting FORCE_MAKE_JOBS, MAKE_JOBS_NUMBER=16 and even have MAKE_JOBS_UNSAFE set in make.conf. The 2nd one did help for ports that used the Ninja build system, but this one uses just GMake, and for some reason that wasn't applied here. So, what gives?

Back in Gentoo I'd be able to compile anything with all my 16 threads by just setting MAKEOPTS="-j16" instead, including NodeJS. So why is this so hard to achieve in FreeBSD??

I know FreeBSD's Make implementation acts more like a build wrapper for standardizing the build process across ports, but I thought it'd be a lot easier to add your own build parameters to the ports instead of··· that.
 
Ports builds are multithreaded by default, without the -j.
that really doesn't seem to be the case, as i've always needed to explicitly tell make that i wanted to build each one of them with multiple jobs, otherwise it'd just compile with a single one

It's not always possible to build things multi-threaded. In some cases you can't build something until something else was built first. They have to be built sequentially.
that rather sounds like compiling multiple ports at the same time, which's not what i'm trying to achieve here
 
UPDATE: turns out i just misunderstood the purpose of MAKE_JOBS_UNSAFE: i thought it was a variable that forced the build system to do a parallel build, because whenever i'd run make -jN on a port, it'd most of the time throw an error telling me to set it and try again
but it's actually the opposite - it marks a port as being unsafe to build using parallel jobs··· the variable that does the opposite is actually MAKE_JOBS_SAFE··· but both of these, apparently, are meant to be set on the port's Makefile instead, and not in a global level

i guess at least for NodeJS this is solved, but i might wanna build more ports to be certain
 
MAKE_JOBS_SAFE
I believe this variable doesn't exist in currently supported variables.

There are four JOBS related variables defined, none of them is the one you mentioned. It can't be found nowhere in the ports framework. Wherever you got the info from, it's nonexistent or outdated.

ports/Mk/bsd.port.mk
Code:
    770 ##
    771 # MAKE_JOBS_UNSAFE
    772 #                               - Disallow multiple jobs even when user set a global override.
    773 #                                 To be used with known bad ports.
    774 # DISABLE_MAKE_JOBS
    775 #                               - Set to disable the multiple jobs feature.  User settable.
    776 # MAKE_JOBS_NUMBER
    777 #                               - Override the number of make jobs to be used.  User settable.
    778 # MAKE_JOBS_NUMBER_LIMIT
    779 #                               - Set a limit for maximum number of make jobs allowed to be
    780 #                                 used.
Code:
~ %  grep  -r  MAKE_JOBS_SAFE  /usr/ports/Mk
 
It takes me 3-4 minutes to fully build Wine with just 'make'...and I'd probably need 50 GHz CPU if it were single job per defaults ;)
 
Wherever you got the info from, it's nonexistent or outdated.
it could be the latter, many search results i get for this forum are

so yeah i guess i can close this now, thanks for the support everyone
 
Back
Top