#8950 closed enhancement (invalid)
Consider using ninja to build cmake packages.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | x-future |
Component: | BOOK | Version: | SVN |
Severity: | normal | Keywords: | |
Cc: |
Description
On the inkscape list this week I saw mention of using 'ninja' to speed the build on MS Windows (MSYS2 or mingw, I think), then somebody chimed in that on linux it vastly speeded up his rebuilds (debug, change one file, rebuild) - apparently cmake insists on checking all the dependencies for each file, or something.
Then, while trying to build rust I noticed that ninja seems to be an option.
I found the 1.7.2 release at https://github.com/ninja-build/ninja/releases - in firefox that gave me a named/versioned tarball, I guess that wget might only produce v1.7.2.tar.gz.
So far, I have not (yet) tried it in rust - still trying to get a default build there to understand the options.
But on the ninja website it says that LLVM can use it, and at https://community.kde.org/Guidelines_and_HOWTOs/CMake/Building the instructions suggest that a different cmake invocation can be used to build the various parts of kde with ninja.
At the moment I have no idea whether it makes a real difference on non-developer machines, so for the moment I'll mark this as future.
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Cool. You only use it for chromium, the reports I have seen suggest it is generally beneficial for cmake packages (some might need 'cmake -G "Ninja" ...' I think). At least the deps don't look bad.
comment:3 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
After trying this, I can generally find no benefit for straight builds.
In some cases (higher-end machines) it might marginally help. But on lesser machines the default of N+2 CPUs might be slightly harmful. Adding -v to stop the stdout only using the last line adds detail of the command-line being run and probably slows things down : piping the command '... 2>&1 | tee somelog' solves the problem without hte extra detail.
On a lower-end 4-core machine, ninja -j4 or default ninja is typically slightly slower than using make -j4.
The only place where it helped was running the llvm tests - those use a lot of time building the test progs before then using all CPUs to run them. Here, make -jN check-all provides a similar improvement.
With hindsight, the reference was for developers - supposedly, rebuilding a package after changing one file takes a long time with the Makefiles produced by cmake (a need to check dependencies of each target, I think) but is very quick with ninja.
Umm...
http://www.linuxfromscratch.org/blfs/view/systemd/general/ninja.html
:-)