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] Status Cmake Win32 support

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Sun, 24 Nov 2013 21:51:47 +0000
dumpcap compiled with the same warning as tshark.

Now for the biggie, Wireshark.

The build is failing to make gtkui DLL, due to missing the pango header files.  Looking at the additional directories passed to the compiler in the vcxproj file, pango definitely isn't in there.  I presume that some magic in FindGTK3.cmake should be locating this.  In FindGTK2.cmake, the pango library is called out directly, but in the GTK3 version I presume this is all handled (or not) by the PKG_CONFIG files.

CMake was reporting PKG_CONFIG not found, but copying pkg-config.exe, libglib-2.0-0.dll and intl.dll from Wireshark libs gtk2\bin dir into my build dir allowed CMake to use pkg-config.  This seemed to pick up all the correct gtk3 include dirs. and libraries, but the build still failed.

Traced this to the (commented) hack in FindGTK3.cmake that purports to fix the broken .pc files in Windows GTK bundles but actually did the opposite for me.  Commenting out the "fix" allowed pkg-config to do its thing and I could build gtkui.

The above fix for gtkui then broke wiretap, and some other things, e.g. dumpcap, as it was picking up the gtk3 version of zlib.h, which included zconf.h which attempted to include unistd.h.  To fix this I modified the CMakeLists.txt for the affect items to put the ZLIB libraries in front of the GLIB ones.  This works for everything except wireshark itself.  Try as I might, I can't persuade CMake to put the zlib includes in front of the gtk-3.0 ones, the library is, but not the includes.  Manually hacking the wireshark.vcxproj file does allow it to build, so I'm close.

So for others:
  1. The GTK2 bundle includes pkg-config, but the GTK3 one doesn't.  Is this something we've done, or does it come that way?  The bundle has all the .pc files so it seems a little odd.
  2. What was the purpose of the FindGTK3.cmake hack to "fix" pkg-config on windows?