Wireshark-dev: Re: [Wireshark-dev] Pointers needed for building Wireshark 2.6.3 on a Raspberry

From: "Geoff Lee" <geoff.lee99@xxxxxxxxx>
Date: Sun, 16 Sep 2018 09:26:03 +1000
Hi Jaap

As requested, some thoughts about possible areas to enhance the User's and Developer's Guides.  (I tend to verbose, so if you decide to follow up any of this, I suggest you just pick the salient points out!)

Looking back (and as an absolute novice member of the general public - this was my first use ever of cmake and ninja, not just my first compile of wireshark) there were three things that might have helped me along the way.  All are sort of trivial, but anyway, they were:

1) Which instructions to follow
2) The very basics of what cmake and ninja are and do
3) How to use the mailing list (better)

Explaining in more detail.

1) Instructions

Before I attempted anything, I did a bit some preliminary research using google. In addition to several independent blog entries about compiling wireshark

(one of which was actually very helpful because it showed me how I could use `sudo apt-get build-dep wireshark` to install all the required dependencies (after I had edited / uncommented a line in `/etc/apt/sources.list`)

I also found build instructions in multiple different places in the official wireshark documentation, namely

The wireshark wiki -> 				https://wiki.wireshark.org/BuildingAndInstalling
The wireshark users guide - unix build -> 	https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixBuild.html
The wireshark developers guide - unix build-> 	https://www.wireshark.org/docs/wsdg_html_chunked/ChSrcBuildFirstTime.html#_building_on_unix
The wireshark users guide, troubleshooting ->	https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixTrouble.html
and
The wireshark2.6 INSTALL file on Github -> 	https://github.com/wireshark/wireshark/blob/master-2.6/INSTALL

It wasn't all that confusing once I got myself organised, but I went back and forth a fair bit while I was just exploring what to do.  The wiki seems to be a bit out of date;  The user's guide and the developer's guide are nice and concise, and all you need if everything works first go,; but in my case I found the INSTALL file easily the most useful once I struck a problem.  I would suggest adding pointers to the INSTALL file into the user's / developer's guides entries. (PS The instructions in the INSTALL file about how to check versions for the dependencies were very useful!)

2) Very basics of cmake and ninja (aka what I wish I'd known when I began)

Had everything worked first time, I wouldn't have needed to know this.  But after what was really quite a minor hiccup I needed to look into what had gone wrong (was it something I'd done wrong, or a missing dependency or what?).  What I wish I'd known is this :

cmake sets everything up for your chosen build system.  Several different build systems are available, including the default "GNU autotools suite - `./configure &&make && make install`, -  and ninja.  Ninja is recommended - it's faster.

cmake 
. reads a file called CMakeLists.txt - which is located in the wireshark **source** directory which was cloned from github or downloaded and unzipped/untarred
. probes the system to see what compiler is installed; what options it supports; which (optional) libraries are installed, and where the requisite .h include header files are located, 
then, if all goes well
. produces a file called build.ninja - which is placed in the (parallel) wireshark **build** directory.  Two log files called CMakeOutput.log, and CMakeError.log are created in the wireshark **build** directory/CMakeFiles subdirectory.

cmake probes the system by running lots of small test compiles.  It is normal and expected for some of these to fail - that is how cmake discovers that a compile option or an optional library is not available.  So if you strike a problem during the cmake step - look at the LAST error message on the console, and the LAST entries in the log files for hints about what has gone wrong!  All the earlier "error" messages are probably just cmake reporting on its normal operations.

ninja reads the build.ninja file in the wireshark **build** directory, and runs the compilation and linking processes.  There are literally thousands of steps when building wireshark for the first time, so this can take quite a long time.  ninja (like most build systems) keeps track of what has already been compiled, so if it falls over or is interrupted for any reason, it is safe to simply restart ninja.  

Ninja is fast because it uses multiple cores.  If you are building on a low spec machine (like a Raspberry Pi) everything else might become utterly unresponsive while ninja is running, because it is using all the available CPU resources.  Don't panic, just wait - and then wait some more :-).

Low spec machines may not be able to complete some of the larger more complex steps while all the cores are in use.  In which case try `ninja -j1` to use only a single core. (This is speculation on my part, but it worked for me on the Raspberry Pi)

(PS When I went to install ninja using apt-get I discovered there were two packages available! One just called `ninja`, and one called `ninja-build`.  `ninja-build` was the one to install (once installed it becomes plain `ninja` anyway)

3) The wireshark-dev mailing list

People on the mailing list were very helpful -THANKS! Very minor points, but :

a) I should have signed up to the mailing list before sending my first email to wireshark-dev@xxxxxxxxxxxxx - it would have saved a moderator the effort of reviewing my email! ; and
b) I should NOT have ticked the email digest option when I did sign up (it made responding to the suggestions I received just a tiny bit harder than it should have been).

Hope these suggestions are helpful

Regards

Geoff

-----Original Message-----
From: Wireshark-dev [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Jaap Keuter
Sent: 13 September, 2018 9:16 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Pointers needed for building Wireshark 2.6.3 on a Raspberry Pi model 3B (armv7 processor?)

Hi Geoff,

Congratulations on your successful build.
Now, looking back, what from your experience would be beneficial to add or change in the User’s Guide/Developer’s Guide for the general public, if anything?

> On 13 Sep 2018, at 06:21, Geoff Lee <geoff.lee99@xxxxxxxxx> wrote:
> 
> Posting this to report success !!!!
> 

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe