This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Build Problems using MSVS2013

0

I am experiencing unexpected errors on compiling and building wireshark-2.2.4.tar.bz2 following the instructions in 2.2. Win32_64 Step-by-Step Guide.htm, using Microsoft Visual Studio 2013 under Windows 7 64 bit OS. All the environment variables appear to be fine, the various components (Qt, Python, Cygwin etc) are correctly found during the build and I am closely following the guide, with only the following exceptions:

PER GUIDE

Base directory for build = C:\Development

Subdirectory of base containing source files = C:\Development\wireshark

PER MY IMPLEMENTATION

Base directory for build = F:\Wireshark_Build

Subdirectory of base containing source files = F:\Wireshark_Build\wireshark_development

I'm not using Git.

** The original question as posted had lots of expected errors from the CMake test compilation steps for features and compiler\linker flags not present on windows. superfluous CMakeError log removed **

The exact CMake generation command which I used is:

cmake -DENABLE_CHM_GUIDES=on -G"Visual Studio 12 Win64" ..\Wireshark_development>> cmakegen.txt 2>&1

The contents of the cmakegen.txt file is pasted below:

-- The C compiler identification is MSVC 18.0.30723.0
-- The CXX compiler identification is MSVC 18.0.30723.0
-- Check for working C compiler: F:/Visual Studio 2013/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: F:/Visual Studio 2013/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: F:/Visual Studio 2013/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: F:/Visual Studio 2013/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Generating build using CMake 3.7.2
-- Found POWERSHELL: C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe  
-- Building for win64 using Visual Studio 12 2013 Win64
Working in F:\Wireshark_Build\Wireshark-win64-libs-2.2

Tag 2016-12-12-2.2 found. Skipping.

– No custom file found in F:/Wireshark_Build/wireshark_development – Configuration types: Debug;Release;MinSizeRel;RelWithDebInfo – CMAKE_C_FLAGS_RELWITHDEBINFO: /MD /Zi /O2 /Ob1 /DNDEBUG – CMAKE_CXX_FLAGS_RELWITHDEBINFO: /MD /Zi /O2 /Ob1 /DNDEBUG – V: 2.2.4-OriginalVersion, MaV: 2, MiV: 2, PL: 4, EV: -OriginalVersion. – Found PythonInterp: F:/Python/python.exe (found version "3.5.3") – Found python module asn2wrs: F:\Wireshark_Build\wireshark_development\tools\asn2wrs.py – Checking for c-compiler flag: /MP – Performing Test C__MP_VALID – Performing Test C__MP_VALID - Success – Checking for c-compiler flag: /Zo – Performing Test C__Zo_VALID – Performing Test C__Zo_VALID - Success – Checking for c-compiler flag: /w34295 /w34189 – Performing Test C__w34295_w34189_VALID – Performing Test C__w34295_w34189_VALID - Success – Checking for c++-compiler flag: /MP – Performing Test CXX__MP_VALID – Performing Test CXX__MP_VALID - Success – Checking for c++-compiler flag: /Zo – Performing Test CXX__Zo_VALID – Performing Test CXX__Zo_VALID - Success – Checking for c++-compiler flag: /w34295 /w34189 – Performing Test CXX__w34295_w34189_VALID – Performing Test CXX__w34295_w34189_VALID - Success statuscheck linker flag - test linker flags: -Wl,–as-needed – Performing Test WS_LD_FLAG_VALID0 – Performing Test WS_LD_FLAG_VALID0 - Failed statuscheck linker flag - test linker flags: -pie – Performing Test WS_LD_FLAG_VALID1 – Performing Test WS_LD_FLAG_VALID1 - Failed – Looking for sys/types.h – Looking for sys/types.h - found – Looking for stdint.h – Looking for stdint.h - found – Looking for stddef.h – Looking for stddef.h - found – Check size of off64_t – Check size of off64_t - failed – Looking for fseeko – Looking for fseeko - not found – Looking for unistd.h – Looking for unistd.h - not found – Packagelist: AIRPCAP;CAP;CARES;GCRYPT;GEOIP;GLIB2;GMODULE2;GNUTLS;GTHREAD2;GTK2;Gettext;Git;KERBEROS;LEX;LIBSSH;LUA;M;PCAP;POD;PORTAUDIO;Perl;PythonInterp;Qt5Core;Qt5LinguistTools;Qt5Multimedia;Qt5PrintSupport;Qt5Svg;Qt5Widgets;Qt5WinExtras;SBC;SED;SETCAP;SH;SMI;WINSPARKLE;YACC;YAPP;ZLIB – Found AIRPCAP: F:/Wireshark_Build/Wireshark-win64-libs-2.2/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include
– AIRPCAP FOUND – AIRPCAP includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include – AIRPCAP libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/lib/airpcap.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'libcap' – Could NOT find CAP (missing: CAP_LIBRARY CAP_INCLUDE_DIR) – CAP NOT FOUND – Found CARES: F:/Wireshark_Build/Wireshark-win64-libs-2.2/c-ares-1.12.0-win64ws/lib/libcares-2.lib
– CARES FOUND – CARES includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/c-ares-1.12.0-win64ws/include – CARES libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/c-ares-1.12.0-win64ws/lib/libcares-2.lib – Found GCRYPT: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/bin/libgcrypt-20.lib (found suitable version "1.6.2", minimum required is "1.4.2") – GCRYPT FOUND – GCRYPT includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/include – GCRYPT libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/bin/libgcrypt-20.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/bin/libgpg-error6-0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'geoip' – Found GEOIP: F:/Wireshark_Build/Wireshark-win64-libs-2.2/GeoIP-1.6.6-win64ws/lib/libGeoIP-1.lib
– Looking for GeoIP_country_name_by_ipnum_v6 – Looking for GeoIP_country_name_by_ipnum_v6 - found – GEOIP FOUND – GEOIP includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/GeoIP-1.6.6-win64ws/include – GEOIP libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/GeoIP-1.6.6-win64ws/lib/libGeoIP-1.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'glib-2.0>=2.14.0' – Found GLIB2: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0.lib
– GLIB2 FOUND – GLIB2 includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/glib-2.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0/include – GLIB2 libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gmodule-2.0' – Found GMODULE2: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gmodule-2.0.lib
– GMODULE2 FOUND – GMODULE2 includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/glib-2.0 – GMODULE2 libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gmodule-2.0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gnutls' – Found GNUTLS: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/bin/libgnutls-28.lib (found suitable version "3.2.15", minimum required is "2.12.0") – GNUTLS FOUND – GNUTLS includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/include – GNUTLS libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gnutls-3.2.15-2.9-win64ws/bin/libgnutls-28.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gthread-2.0' – Found GTHREAD2: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0.lib
– GTHREAD2 FOUND – GTHREAD2 includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/glib-2.0/glib – GTHREAD2 libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0.lib – Found GTK2_GTK: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gtk-win32-2.0.lib
– GTK2 FOUND – GTK2 includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/gtk-2.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/freetype2;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/glib-2.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0/include;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/atk-1.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/gdk-pixbuf-2.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/cairo;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/include/pango-1.0;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gtk-2.0/include – GTK2 libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/glib-2.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gobject-2.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/atk-1.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gmodule-2.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gdk_pixbuf-2.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/cairo.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/pango-1.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/pangocairo-1.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gdk-win32-2.0.lib;F:/Wireshark_Build/Wireshark-win64-libs-2.2/gtk2/lib/gtk-win32-2.0.lib – Could NOT find Gettext (missing: GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) – GETTEXT NOT FOUND – Could NOT find Git (missing: GIT_EXECUTABLE) – Git NOT FOUND – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'krb5;mit-krb5;heimdal-krb5' – Found KERBEROS: F:/Wireshark_Build/Wireshark-win64-libs-2.2/kfw-3-2-2-x64-ws/lib/krb5_64.lib
– Looking for heimdal_version – Looking for heimdal_version - not found – KERBEROS FOUND – KERBEROS includes: F:/Wireshark_Build/Wireshark-win64-libs-2.2/kfw-3-2-2-x64-ws/include – KERBEROS libs: F:/Wireshark_Build/Wireshark-win64-libs-2.2/kfw-3-2-2-x64-ws/lib/krb5_64.lib CMake Error at F:/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message): Could NOT find LEX (missing: LEX_EXECUTABLE) Call Stack (most recent call first): F:/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindLEX.cmake:23 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:828 (find_package)

– Configuring incomplete, errors occurred! See also "F:/Wireshark_Build/wsbuild64/CMakeFiles/CMakeOutput.log". See also "F:/Wireshark_Build/wsbuild64/CMakeFiles/CMakeError.log".

asked 01 Mar ‘17, 12:00

Utnapishtim's gravatar image

Utnapishtim
31336
accept rate: 100%

edited 04 Mar ‘17, 10:53

grahamb's gravatar image

grahamb ♦
19.8k330206


2 Answers:

0

** This was the original answer to the question about the expected CMake test compilation errors **

I was once told the CMake "way" was to not clutter the CMakeLists.txt files with lots of conditionals based on the build OS, just to let CMake sort it out. This leads to (IMHO) useless tests for compiler and linker flags and also searches for libraries that will never be found on some build targets.

Regardless of that gripe, the failures the OP posts are expected as these are the test of linker flags and unavailable libraries and functions that fail on Windows.

What's missing from the wall of text is the output of the CMake generation step. Please delete the CMakeCache.txt file from the build directory and run the CMake generation command being used, redirecting output to a text file and then post the contents of the text file, e.g.

cmake ... 2&>1 > cmakegen.txt

Please also post the exact CMake generation command being used.

** This is the amended answer after the OP posted the required CMake generation step output **

The configure step shows the issue:

CMake Error at F:/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message): Could NOT find LEX (missing: LEX_EXECUTABLE)

You appear to have missed the installation of flex\bison as noted in the Developers Guide section Install Cygwin. Currently the recommended install is winflexbison via chocolatey.

I have just noted however, that chocolatey now has two separate packages for winflexbison; winflexbison and winflexbison3. I'm successfully using the newer winflexbison3 but the Dev Guide still uses the older one.

answered 02 Mar '17, 00:14

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

edited 04 Mar '17, 11:01

Glad to hear it's fixed. I see no need to pass the full path for the solution. It's in the directory you should be starting the build from so msbuild will find it there.

This question (and comments) has become a gigantic wall of text that's mostly irrelevant and unhelpful to others, so with your permission I'd like to reorganise it to just show the CMake generation log in the question and change my answer to point out the flex\bison issue and then your comment to that answer stating that it worked.

(02 Mar '17, 04:40) grahamb ♦

For what it's worth:

statuscheck linker flag - test linker flags: -Wl,--as-needed
-- Performing Test WS_LD_FLAG_VALID0
-- Performing Test WS_LD_FLAG_VALID0 - Failed
statuscheck linker flag - test linker flags: -pie
-- Performing Test WS_LD_FLAG_VALID1
-- Performing Test WS_LD_FLAG_VALID1 - Failed

seems to indicate that CMake found that -Wl,--as-needed and -pie were found not to have worked, so it should not have included them as linker flags.

(04 Mar '17, 10:58) Guy Harris ♦♦

Gah, I've managed to delete the comment from @Utnapishtim showing that the build completed when trying to clean up the massive wall of text.

(04 Mar '17, 11:04) grahamb ♦

alt text

Gah, I've managed to delete the comment from @Utnapishtim showing that the build completed when trying to clean up the massive wall of text.

After some rummaging around, I have managed to find & have reloaded the Build Completed Screendump, which @grahamb threw out with the bathwater.

(07 Mar '17, 02:56) Utnapishtim

We now seem to have a reasonably clear question and answer that will hopefully help others.

@Utnapishtim, if an answer has solved your issue, please accept the answer for the benefit of other users by clicking the checkmark icon next to the answer. Please read the FAQ for more information.

(07 Mar '17, 03:17) grahamb ♦

0

I'm surprised this works at all on Windows, but apparently it does, because our Windows buildbot works.

We appear to make -Wl,--as-needed as a linker flag on all platforms, even though --as-needed is a flag specific to the GNU linker. Perhaps some versions of CMake are clever enough to know that and to use it only with the GNU linker - CMake builds work on my machine, but it's running macOS and uses Apple's linker.

Please file a bug on this on the Wireshark Bugzilla; I'll look at it.

answered 01 Mar '17, 16:15

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

OK, the CMake files try to check each of the flags to see whether it works with the linker. On macOS, it detects that -Wl,--as-needed doesn't work and removes it from the flags, and it may do so on our Windows buildbot, but perhaps that check isn't working on your machine.

(01 Mar '17, 16:20) Guy Harris ♦♦

Thank you Guy. Its late here in the UK, and I shall fight it out with CMake tomorrow. Would you be so kind as to tell me which file to edit in order to remove the -Wl flag ?

(01 Mar '17, 16:31) Utnapishtim

If you just want to hack it so that it builds, remove

set(WIRESHARK_LD_FLAGS
    -Wl,--as-needed
    # -flto
    # -fwhopr
    # -fwhole-program
)
# CMAKE_POSITION_INDEPENDENT_CODE is only supported starting with CMake
# 2.8.9. Do not add -pie automatically for older versions.
#
# XXX - are there other compilers that don't support -pie?  It's
# not as if the only platforms we support are Windows and Linux....
#
if(NOT CMAKE_VERSION VERSION_LESS "2.8.9")
    set(WIRESHARK_LD_FLAGS ${WIRESHARK_LD_FLAGS}
        -pie
    )
endif()

from CMakeLists.txt.

(01 Mar '17, 18:25) Guy Harris ♦♦

This answer and the subsequent comments now don't make much sense after I've reorganised the question to remove the massive and mostly irrelevant wall of text about expected CMake errors when testing compiler\linker flags and checking for libraries and functions.

This was done to actually make the question and the subsequent answer useful for others.

(04 Mar '17, 10:55) grahamb ♦