Gentoo Archives: gentoo-dev

From: "Justin Lecher (jlec)" <jlec@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: RFC: using Ninja in more CMake-based packages
Date: Sun, 07 Jun 2015 20:19:18
Message-Id: 5574A735.9040304@gentoo.org
In Reply to: [gentoo-dev] Re: RFC: using Ninja in more CMake-based packages by Johannes Huber
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA512
3
4 On 07/06/15 22:14, Johannes Huber wrote:
5 > Am Sonntag 07 Juni 2015, 17:08:57 schrieb Michał Górny:
6 >> Hello, developers.
7 >
8 > Hello Michal,
9 >
10 >> As you probably know already, CMake sucks a lot. One of its more
11 >> sucky features is that it generates Makefiles that fail a lot. In
12 >> particular, they fail at verbose build logs that are cluttered
13 >> with useless CMake intermediate commands and hard to read. But
14 >> also they sometimes deadloop hard in faulty dependency scanning
15 >> [1].
16 >>
17 >> Those two issues can be solved by switching CMake to use Ninja
18 >> instead of make. As you may know, Ninja is the fancy building
19 >> tool that is faster and much harder to use than make. However, it
20 >> integrates with CMake much better and with less hackery. In
21 >> particular, the verbose build log is free of useless CMake
22 >> percentage printing output and other non-sense, and contains only
23 >> real build commands. It also gets dependency scanning right.
24 >>
25 >> Sadly, there are two problems with using Ninja:
26 >>
27 >> 1) it will not work with some packages,
28 >>
29 >> 2) it introduces an extra dep (on Ninja).
30 >>
31 >> The first issue is a bit complex. Sometimes the problem lies in
32 >> CMake itself (not all CMake magic works in Ninja for some
33 >> reason), sometimes in the project (relying on Makefile stuff),
34 >> sometimes in the ebuild. For example, with Ninja you can't do '-C
35 >> subdirectory' to run targets from a specific subdirectory. So, we
36 >> can't force Ninja everywhere.
37 >>
38 >> The second issue is a bit easier. GNU make is part of @system,
39 >> ninja would be considered an extra package being installed. Do we
40 >> consider it fine to require it randomly? Or do we need to justify
41 >> the extra dep by benefits of building a particular package with
42 >> Ninja? Is sane verbose build log a good enough benefit?
43 >>
44 >> So, what do you think? Should I start switching random packages
45 >> to Ninja whenever it works?
46 >>
47 >> Oh, and this would be done via something like: :
48 >> ${CMAKE_MAKEFILE_GENERATOR:=Ninja}
49 >>
50 >> before inherit line. To respect user forcing another generator,
51 >> and to get deps right.
52 >>
53 >> [1]:https://bugs.gentoo.org/show_bug.cgi?id=546336
54 >
55 > KDE herd maintains ~1000 packages and the majority relies on CMake.
56 > I am not aware of any reports about GNU make related build files.
57 > So i would vote for the reliable GNU make generator.
58 >
59
60 I tested ninja some while ago on some big cmake science projects and I
61 found it to be faster. So I would vote for Micheals suggestion. Though
62 I also never faced any problems with the makefiles either. It's purely
63 that I found ninja to work smooth and fast.
64
65 Justin
66
67 -----BEGIN PGP SIGNATURE-----
68 Version: GnuPG v2.0
69
70 iQJ8BAEBCgBmBQJVdKc1XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
71 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
72 OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiDBQP/R2vvdQGBOUGHX5wNHCjJxoy
73 XPQdJq7Y+ihrDj+630/EIzvncZjLXpJ1r03ftfQ8Km38m1dIL9HHVIX4Z6NHokwe
74 bmEs1VAQk+3NajmzB4Wt6xJoiIPiQiIDeNLAYhe8MVL1qK+LW5sgC8gV7PWwau7b
75 7CsBbPJOE1Y/rcjc8B3c630hE8WXAfQ1lnIBR7EzNsnNwTp5s8F4u7JktZSKkSSc
76 g1545i8EBaV2eHeEatIqEpB2oGDp2eDZjeLny7nlCU0FO0MfFFsTWBXEJHUDIto4
77 ammwydyWLGBACU97jBkoePgSp54ekAW3XdtMFG9KT7/rArtgDY06wWFH2BqA0tcx
78 qYGXqT1QBzjjUmTyQmHflKv3Zx233RD2h4J2g9A0wE5CKZViKdfKWADG0tyIRlOI
79 ooZKj7sp/iKZbgQqVdHPqySw7clUFi0LGUr7RQr/RUC1z+ROSb+x+dCkSV9ujPSF
80 A8acKoEu7cjjGU4P/RFiWbHR/czMXiv21VmAvD4sdqibkYlfR/YWyctz0JMzfIdz
81 tB6ZDpedB3Qsu0tTdlnOYiCMpoMH/ZBK3vjLcG/72BkqjyyD32xJu1KVVARao+ZQ
82 4cOxNXDA35yeOnZ77pNLNhkS8CToGuijqtUdkDhYq+rhLFOkNcTbl+fR88UuTeAH
83 ZwGZmZGkP1jubaDIN+NL
84 =17Cu
85 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-dev] Re: RFC: using Ninja in more CMake-based packages Christoph Junghans <ottxor@g.o>