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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 17 Sep 2018 19:04:56 +0200
HI,

Just a few responses on some items here. It seems that you got into building a (rather complicated) program for the first time. Please excuse us for not being in the business of teaching ‘first timers’ how this is done on the multitude of platforms this software is supposed to run on. That is just out of our scope. However, we do try to make the process as smooth as possible by preparing the build system in great detail.

The use of sudo apt-get build-dep wireshark is nice, as in it prepared the system for building *that version* of Wireshark. These build dependancies, although fairly stable, do change from time to time. It could be that the build-dep you’ve installed only partially matches the intended build target. Fortunately this didn’t cause a problem.

It’s good to see that you’ve found a multitude of instructions. The fact that you found one more up to date and/or more relevant to your issues, leads to two conclusions. 1. The documentation (the Wiki) should be maintained to be up to date. 2. Duplication of documentation needs to be reduced. All this is an ongoing effort.

The getting to know cmake (and ninja) could be considered ‘basic knowledge’ of a software developer. When I was first confronted with them I just took to the web (like you did), found some excellent material that answered my specific questions, then went on to use it tweaking Wireshark builds. BTW: the autotools are on their way out, being removed from the repository master branch.
As for your specifics on compiling on the Pi, again the multitude of platforms this software is supposed to run on, makes it impossible to have detailed documentation on all of them. Maybe a Wiki page with tips on specific platforms, where tips on building, setting up, different capture options, etc, would be useful.

The two Debian packages with the name ninja, is a Debian naming conflict resolution thing. So, this is specific to this distribution (and derivatives).

The mailing lists are a somewhat undervalued resource, in this day and age of web based interactions. Not uncommon these days is a question on ‘Ask’ being the first contacts after which referral may follow, to either bugzilla, mailing list, Gerrit, etc.

So, reading this, all in all not a bad experience. You’ve gained a lot of valuable experience and knowledge, which will pay off later when dealing with software packages. 
I’ll have to go re-read the documents referenced, see what would benefit from some more attention. The Wiki could for sure, another undervalued resource, IMHO.

Thanks,
Jaap



> On 16 Sep 2018, at 01:26, Geoff Lee <geoff.lee99@xxxxxxxxx> wrote:
> 
> 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
> 
> ___________________________________________________________________________
> 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