Generating Blender project with CMake and Ninja fails

Hi everyone,

I am trying to write a batch script to update blender source code and compile it, and it is working fine with CMake only. But the issue comes up when I try to use Ninja to speedup the process, here is the command that fails :
cmake -GNinja -S D:/prog/blender_git/blender -B D:/prog/blender_git/branches/master_branch_ninja

And here is the error :

– The C compiler identification is MSVC 19.26.28806.0
– The CXX compiler identification is MSVC 19.26.28806.0
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe – broken
CMake Error at D:/softwares/CMake/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: D:/prog/blender_git/branches/master_branch_ninja/CMakeFiles/CMakeTmp

Run Build Command(s):D:/softwares/ninja/ninja.exe cmTC_d1e30
[1/2] Building C object CMakeFiles\cmTC_d1e30.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_d1e30.exe
FAILED: cmTC_d1e30.exe
cmd.exe /C "cd . && D:\softwares\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_d1e30.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_d1e30.dir\testCCompiler.c.obj  /out:cmTC_d1e30.exe /implib:cmTC_d1e30.lib /pdb:cmTC_d1e30.pdb /version:0.0  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /foCMakeFiles\cmTC_d1e30.dir/manifest.res CMakeFiles\cmTC_d1e30.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:115 (project)

– Configuring incomplete, errors occurred!
See also “D:/prog/blender_git/branches/master_branch_ninja/CMakeFiles/CMakeOutput.log”.
See also “D:/prog/blender_git/branches/master_branch_ninja/CMakeFiles/CMakeError.log”.

Do you have any idea where that could come from ?

After researching on the internet I found that it could come from the missing rc.exe in my path, but I tried to add it but still have the same issue.

Let me know if you have any clue :slight_smile:

Cheers !

I found these:

1 Like
  1. Make sure your cmake is upto date, older versions have various levels of wonkyness although anthing newer than probably 3.15 will do the trick.

  2. Try using the make.bat we ship to setup the build, it’s designed to catch and correct many mis-confiurations. (for details see the build wiki)

    ninja is supported on windows straight from make.bat if you would normally use make full you can just tag on ninja and it’ll use ninja ie make full ninja

  3. if 2 is not working, or not an option for you for some reason, try passing cmake the location of RC using -DCMAKE_RC_COMPILER=c:/somewhere/rc.exe

1 Like

Thanks a lot, this worked, I don’t know why I only used make update as make full ninja is building everything from start to finish :slight_smile:

The only thing I am missing is how I can choose the destination folder using your make.bat command ?

make full ninja builddir mah_build_with_ninja

do note that absolute paths are not supported currently (ie, make full ninja builddir c:\ssd\buld\here\mah_build_with_ninja won’t work)


Just to clarify make update and make full are two fundamentally different things, one is not a super set of the other, make update will only check the blender repositories for updates (but not build), while make full will only build (and not update), if you want to keep up with development you’d use both commands on a regular basis.

1 Like

Oh ok, I thought I saw the update executing in the terminal, thanks for the clarification :slight_smile:

Seems to work great now :slight_smile: Thanks a lot for your help !

make update is basically just:

#in the precompiled libraries directory
svn cleanup
svn update
#then in the blender directory
git pull --rebase
git submodule foreach git pull --rebase origin master

But that’s tedious to do every time, so make update does it for you.

1 Like