I can’t figure out how to set the -j
flag for building blender.
When run from a cron job to rebuild it, it keeps returning to -j 12
(maximum number of cores).
Any suggestions would be really appreciated.
UPDATE: It turned out there was another schduled job on the system rebuilding blender that was causing this issue.
This doesn’t does work:
/home/user/bin/cron/rebuild-blender-git.sh
#!/usr/bin/env sh
cd /home/user/src/blender-git/blender
make update
cd /home/user/src/blender-git/build_linux
make -j3
NPROCS=3 make
should do the trick, it’s documented in make help
1 Like
Thank you. Sorry, but the cause of the issue turned out to be my oversight. 3 months ago I created another “cron job” (systemd timer) that run make update
and make
without either -j
flag or the environment variable you mentioned. I believe that removing it will solve the issue. I completely forgot about it and it only activated itself after I rebuild blender (in the same directory).
In other word both the script above and your answer should be correct.
yeah it can be a bit confusing, running make in the source folder will need NPROCS to be set, while if you run make in your build folder -j should be used.
1 Like
D:\Blender-git\blender>NPROCS=4 make
'NPROCS' is not recognized as an internal or external command,
operable program or batch file.
Hi, I got this error when trying to use this command. I can use make
normally, but it’s overheating my CPU, so I think I have everything installed correctly. I also tried the -j
flag, but it didn’t work either.
Edit: Sorry, I forgot to mention. I am using Windows 10. I think the OP is using Linux.
Edit 2: Is the only way to limit the number of processors used on Windows through Visual Studio?
NPROCS
is indeed a linux thing, on windows msbuild (the default) is a bit unwieldy to control, if you have ninja installed however it’s pretty easy (but it’s command line only, you lose the Visual Studio IDE):
make ninja nobuild builddir my_build
cd ../my_build
rebuild -j3
Sorry I am totally new to this. May I ask if there is anything I will lose out by using ninja? I see on the documentation here: Build Options - Blender Developer Documentation
that there are other Build Targets that are faster but come with fewer features. Is ninja just faster without compromising anything?
the blender build will be the same regardless of build system, but like i said, you’re limited to command line builds (ie no IDE) so that’s definitely a loss from a developer perspective.
1 Like
I have another question. Using ninja. If I make any changes to the source code, do I just use rebuild
to compile them?
Yes, that would do the trick.
There is no need to type this in again?
once you have your build folder, it’s almost never needed, but it can occasionally occur when we do library updates, it’s rare though
1 Like