ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Compiling with ninja

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Mon, 10 Nov 2014 16:00:05 -0500
On 11/04/14 09:12, Dario Lombardo wrote:
Hi list
Some days ago I played a bit with ninja and I found useful info I'd like
to share with you.
Ninja is a compilation system similar to make. It's advantage is that it
was built with parallelism in mind, to take advantage of multi-core CPUs.
Wireshark uses cmake that has a generator for ninja, so I decided to
make some tests.

1) cmake and make
This a very common way to compile stuff, and wireshark too. The
advantage of using cmake and make is that you get a progress of the
compilation. Very useful! The disadvantage is that this progress runs
bad with parallel make (-j). Not only the output is a mess, but
sometimes compilation breaks. I think that cmake doesn't manage well
parallel gcc instances. Autotools manage well parallel make, but afaik
the cmake subsystem in wireshark has a better support.

FWIW the autotools' parallel make stuff works quite well. I think quite a number of people still use it as their primary build system so it's quite well supported.

I can also do parallel cmake builds (cmake version is 2.8.12.2) with significant speedup and only minor output messiness, for example:

[ 58%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-mip.c.o
[ 58%] [ 58%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-mip6.c.o
Building C object epan/CMakeFiles/epan.dir/dissectors/packet-mmse.c.o

This is all on Fedora 20.

Some stats:

autotools (compiling Gtk2 and Qt GUIs):
---------------------------------------
make: 9m43 (9 minutes 43 seconds)
make -j 9: 2m45

cmake (compiling just the Gtk3 GUI):
------------------------------------
make: 6m55
make -j 9: 1m57