Wireshark-dev: Re: [Wireshark-dev] Trunk Windows CMake builds are broken

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Thu, 21 Aug 2014 09:57:14 +0100
On 21 August 2014 09:13, Guy Harris <guy@xxxxxxxxxxxx> wrote:
         alert_box.c
    55>c:\buildbot\wireshark\wireshark-master-64\win7x64\build\config.h(256): warning C4005: 'VERSION' : macro redefinition (..\..\..\ui\gtk\capture_dlg.c) [C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\ui\gtk\gtkui.vcxproj]
                 C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\config.h(9) : see previous definition of 'VERSION'
    55>c:\buildbot\wireshark\wireshark-master-64\win7x64\build\config.h(264): warning C4005: 'HTML_VIEWER' : macro redefinition (..\..\..\ui\gtk\capture_dlg.c) [C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\ui\gtk\gtkui.vcxproj]
                 C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\config.h(321) : see previous definition of 'HTML_VIEWER'
       ClCompile:
         capture.c
    58>CustomBuild:
         Generating moc_capture_filter_edit.cpp
    55>..\..\..\ui\gtk\capture_dlg.c(565): error C2065: 'airpcap_if_active' : undeclared identifier [C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\ui\gtk\gtkui.vcxproj]
    55>..\..\..\ui\gtk\capture_dlg.c(566): warning C4013: 'airpcap_set_toolbar_stop_capture' undefined; assuming extern returning int [C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\ui\gtk\gtkui.vcxproj]

        ...

We appear to have too many config.h files, and they're defining things inconsistently.  This might be causing problems if, for example, one of them is included in a .c file, and another one is included in a .h file, and they define something such as HAVE_AIRPCAP differently, such that the .h file is built with it not defined and the .c file is built with it defined.

This obviously worked before the merge of ExtCap, so that has disturbed things.  The CMake build should be using the generated one in the CMake build directory, i.e. C:\buildbot\wireshark\wireshark-master-64\win7x64\build\cmbuild\config.h, but the nmake build copy is getting in the mix.

Possible cause is capture_dlg.c has #include "config.h", which will pick up the CMake copy via the include directory options passed to the compiler as there is no config.h in ui\gtk, but it also has #include "extcap.h" which also has a #include "config.h" and as that does have a config.h in the same directory (the nmake one), that gets pulled in.

I suspect the ExtCap changes might cause difficulty with other out-of-tree builds.

A solution might be to change the include in extcap.h to be #include <config.h> so the current directory isn't searched, but that seems a bit hackish to me.

--
Graham Bloice