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

Error while building Wireshark in Visual Studio 2013

0

I am trying to build Wireshark in my 64 bit Windows7 machine. I downloaded the source code(2.0.1) from downloads and configured and generated using CMake as per this documentation. All these were OK. Then I built the generated Wireshark.sln file in Visual Studio 2013. First it gave me an error because of which I had to install flex 2.5.37. Now while building, the previous error was solved and it tells :

1>------ Build started: Project: wiretap, Configuration: RelWithDebInfo Win32 ------
1>  ascend_scanner.c
1>E:/WShark/Build/wiretap/ascend_scanner_lex.h(111): warning C4005: 'yyconst' : macro redefinition
1>          E:/WShark/Build/wiretap/ascend_scanner.c(128) : see previous definition of 'yyconst'
1>E:/WShark/Build/wiretap/ascend_scanner_lex.h(195): warning C4028: formal parameter 1 different from declaration
1>E:/WShark/Build/wiretap/ascend_scanner_lex.h(196): warning C4028: formal parameter 1 different from declaration
1>E:/WShark/Build/wiretap/ascend_scanner.c(1793): error C2065: 'YY_DO_BEFORE_ACTION' : undeclared identifier
1>E:/WShark/Build/wiretap/ascend_scanner.c(2271): error C2065: 'YY_NEW_FILE' : undeclared identifier
1>E:/WShark/Build/wiretap/ascend_scanner.c(2590): error C2065: 'YY_NEW_FILE' : undeclared identifier
1>E:/WShark/Build/wiretap/ascend_scanner.c(2967): warning C4028: formal parameter 1 different from declaration
2>------ Build started: Project: epan, Configuration: RelWithDebInfo Win32 ------
2>LINK : fatal error LNK1181: cannot open input file '..\run\RelWithDebInfo\wiretap-2.0.1.lib'
3>------ Build started: Project: wireshark, Configuration: RelWithDebInfo Win32 ------
3>LINK : fatal error LNK1181: cannot open input file 'run\RelWithDebInfo\wireshark.lib'
========== Build: 0 succeeded, 3 failed, 10 up-to-date, 0 skipped ==========

Please help me to solve this :(..

EDIT: output of Cmake

-- Generating build using CMake 3.4.1
-- Building for win32 using Visual Studio 12 2013
Working in E:\WShark\Wireshark-win32-libs-2.0

Tag 2015-12-11 found. Skipping.

– No custom file found in E:/WShark/wireshark – Configuration types: Debug;Release;MinSizeRel;RelWithDebInfo – RelWithDebInfo: /MD /Zi /O2 /Ob1 /D NDEBUG – V: 2.0.1, MaV: 2, MiV: 0, PL: 1, EV: . – Checking for c-compiler flag: /MP – Checking for c-compiler flag: /Zo – Checking for c-compiler flag: /w34295 /w34189 – Checking for c++-compiler flag: /MP – Checking for c++-compiler flag: /Zo – Checking for c++-compiler flag: /w34295 /w34189 – Packagelist: AIRPCAP;CAP;CARES;GCRYPT;GEOIP;GLIB2;GMODULE2;GNUTLS;GTHREAD2;GTK2;Gettext;HtmlViewer;KERBEROS;LEX;LUA;M;PCAP;POD;PORTAUDIO;Perl;PythonInterp;Qt5Core;Qt5LinguistTools;Qt5Multimedia;Qt5PrintSupport;Qt5Svg;Qt5Widgets;Qt5WinExtras;SBC;SED;SETCAP;SH;SMI;WINSPARKLE;YACC;YAPP;ZLIB – AIRPCAP FOUND – AIRPCAP includes: E:/WShark/Wireshark-win32-libs-2.0/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include – AIRPCAP libs: E:/WShark/Wireshark-win32-libs-2.0/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 – CARES FOUND – CARES includes: E:/WShark/Wireshark-win32-libs-2.0/c-ares-1.9.1-1-win32ws/include – CARES libs: E:/WShark/Wireshark-win32-libs-2.0/c-ares-1.9.1-1-win32ws/lib/libcares-2.lib – GCRYPT FOUND – GCRYPT includes: E:/WShark/Wireshark-win32-libs-2.0/gnutls-3.2.15-2.7-win32ws/include – GCRYPT libs: E:/WShark/Wireshark-win32-libs-2.0/gnutls-3.2.15-2.7-win32ws/bin/libgcrypt-20.lib;E:/WShark/Wireshark-win32-libs-2.0/gnutls-3.2.15-2.7-win32ws/bin/libgpg-error-0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'geoip' – GEOIP FOUND – GEOIP includes: E:/WShark/Wireshark-win32-libs-2.0/GeoIP-1.6.6-win32ws/include – GEOIP libs: E:/WShark/Wireshark-win32-libs-2.0/GeoIP-1.6.6-win32ws/lib/libGeoIP-1.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'glib-2.0>=2.14.0' – GLIB2 FOUND – GLIB2 includes: E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/glib-2.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/glib-2.0/include – GLIB2 libs: E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/glib-2.0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gmodule-2.0' – GMODULE2 FOUND – GMODULE2 includes: E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/glib-2.0 – GMODULE2 libs: E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gmodule-2.0.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gnutls' – GNUTLS FOUND – GNUTLS includes: E:/WShark/Wireshark-win32-libs-2.0/gnutls-3.2.15-2.7-win32ws/include – GNUTLS libs: E:/WShark/Wireshark-win32-libs-2.0/gnutls-3.2.15-2.7-win32ws/bin/libgnutls-28.lib – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'gthread-2.0' – GTHREAD2 FOUND – GTHREAD2 includes: E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/glib-2.0/glib – GTHREAD2 libs: E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gthread-2.0.lib – GTK2 FOUND – GTK2 includes: E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/gtk-2.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/freetype2;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/glib-2.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/glib-2.0/include;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/atk-1.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/gdk-pixbuf-2.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/cairo;E:/WShark/Wireshark-win32-libs-2.0/gtk2/include/pango-1.0;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gtk-2.0/include – GTK2 libs: E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/glib-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gobject-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/atk-1.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gio-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gthread-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gmodule-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gdk_pixbuf-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/cairo.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/pango-1.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/pangocairo-1.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/pangoft2-1.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gdk-win32-2.0.lib;E:/WShark/Wireshark-win32-libs-2.0/gtk2/lib/gtk-win32-2.0.lib – Could NOT find Gettext (missing: GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) – GETTEXT NOT FOUND – HTML_VIEWER NOT FOUND – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'krb5;mit-krb5;heimdal-krb5' – KERBEROS FOUND – KERBEROS includes: E:/WShark/Wireshark-win32-libs-2.0/kfw-3-2-2-i386-ws-vc6/include – KERBEROS libs: E:/WShark/Wireshark-win32-libs-2.0/kfw-3-2-2-i386-ws-vc6/lib/krb5_32.lib – LEX FOUND – LEX includes: – LEX libs: – LEX executable: C:/GnuWin32/bin/flex.exe – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'lua5.2;lua-5.2;lua52;lua5.1;lua-5.1;lua51;lua5.0;lua-5.0;lua50' – Checking for one of the modules 'lua<=5.2.99' – LUA FOUND – LUA includes: E:/WShark/Wireshark-win32-libs-2.0/lua5.2.3/include – LUA libs: E:/WShark/Wireshark-win32-libs-2.0/lua5.2.3/lua52.lib – Could NOT find M (missing: M_LIBRARY) – M NOT FOUND – PCAP FOUND – PCAP includes: E:/WShark/Wireshark-win32-libs-2.0/WpdPack/Include – PCAP libs: E:/WShark/Wireshark-win32-libs-2.0/WpdPack/Lib/wpcap.lib – POD FOUND – POD includes: – POD libs: – Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) – Checking for one of the modules 'portaudio-2.0' – PORTAUDIO FOUND – PORTAUDIO includes: E:/WShark/Wireshark-win32-libs-2.0/portaudio_v19_2/include;E:/WShark/wireshark-win32-libs-2.0/portaudio_v19_2/src/common;E:/WShark/wireshark-win32-libs-2.0/portaudio_v19_2/src/os/win – PORTAUDIO libs: – PERL FOUND – Perl includes: – Perl libs: – Perl executable: C:/Perl/bin/perl.exe – PYTHONINTERP FOUND – PythonInterp includes: – PythonInterp libs: – Qt5Core FOUND – Qt5Core includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013 – Qt5Core libs: Qt5::Core – Qt5Core definitions: -DQT_CORE_LIB – Qt5LinguistTools FOUND – Qt5LinguistTools includes: – Qt5LinguistTools libs: – Qt5Multimedia FOUND – Qt5Multimedia includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtMultimedia;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtNetwork;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtGui – Qt5Multimedia libs: Qt5::Multimedia – Qt5Multimedia definitions: -DQT_MULTIMEDIA_LIB;-DQT_NETWORK_LIB;-DQT_CORE_LIB;-DQT_GUI_LIB – Qt5PrintSupport FOUND – Qt5PrintSupport includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtPrintSupport;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtWidgets;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtGui;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013 – Qt5PrintSupport libs: Qt5::PrintSupport – Qt5PrintSupport definitions: -DQT_PRINTSUPPORT_LIB;-DQT_WIDGETS_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB – Qt5Svg FOUND – Qt5Svg includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtSvg;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtWidgets;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtGui;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013 – Qt5Svg libs: Qt5::Svg – Qt5Svg definitions: -DQT_SVG_LIB;-DQT_WIDGETS_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB – Qt5Widgets FOUND – Qt5Widgets includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtWidgets;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtGui;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013 – Qt5Widgets libs: Qt5::Widgets – Qt5Widgets definitions: -DQT_WIDGETS_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB – Qt5WinExtras FOUND – Qt5WinExtras includes: D:/QT/Qt5.4.0/5.4/msvc2013/include/;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtWinExtras;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtGui;D:/QT/Qt5.4.0/5.4/msvc2013/include/QtCore;D:/QT/Qt5.4.0/5.4/msvc2013//mkspecs/win32-msvc2013 – Qt5WinExtras libs: Qt5::WinExtras – Qt5WinExtras definitions: -DQT_WINEXTRAS_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB – Could NOT find SBC (missing: SBC_INCLUDE_DIR SBC_LIBRARY) – SBC NOT FOUND – SED FOUND – SED includes: – SED libs: – SED executable: C:/cygwin/bin/sed.exe – Could NOT find SETCAP (missing: SETCAP_EXECUTABLE) – SETCAP NOT FOUND – SH FOUND – SH includes: – SH libs: – SH executable: C:/cygwin/bin/bash.exe – SMI FOUND – SMI includes: E:/WShark/Wireshark-win32-libs-2.0/libsmi-svn-40773-win32ws/include – SMI libs: E:/WShark/Wireshark-win32-libs-2.0/libsmi-svn-40773-win32ws/lib/libsmi-2.lib – WINSPARKLE FOUND – WINSPARKLE includes: E:/WShark/Wireshark-win32-libs-2.0/WinSparkle-0.3-44-g2c8d9d3-win32ws – WINSPARKLE libs: E:/WShark/Wireshark-win32-libs-2.0/WinSparkle-0.3-44-g2c8d9d3-win32ws/WinSparkle.lib – YACC FOUND – YACC includes: – YACC libs: – YACC executable: C:/GnuWin32/bin/bison.exe – Could NOT find YAPP (missing: YAPP_EXECUTABLE) – YAPP NOT FOUND – ZLIB FOUND – ZLIB includes: E:/WShark/Wireshark-win32-libs-2.0/zlib-1.2.8-ws;E:/WShark/Build/zlib – ZLIB libs: zlib – C-Flags: /MP /w34295 /w34189 /DWIN32 /D_WINDOWS /W3 – CXX-Flags: /MP /w34295 /w34189 /DWIN32 /D_WINDOWS /W3 /GR /EHsc – Using Cygwin a2x – No custom file found in E:/WShark/wireshark/epan – No custom file found in E:/WShark/wireshark/ui/gtk – docdir:

– The following OPTIONAL packages have been found:

  • AIRPCAP
  • CARES
  • GCRYPT (required version >= 1.4.2)
  • GEOIP
  • GMODULE2
  • GNUTLS (required version >= 2.12.0)
  • GTK2
  • HtmlViewer
  • KERBEROS
  • LUA
  • PCAP
  • POD
  • PORTAUDIO
  • Perl
  • Qt5Core
  • Qt5LinguistTools
  • Qt5Network (required version >= 5.4.0)
  • Qt5Gui (required version >= 5.4.0)
  • Qt5Multimedia
  • Qt5PrintSupport
  • Qt5Svg
  • Qt5Widgets
  • Qt5WinExtras
  • SH
  • SMI
  • WINSPARKLE
  • ZLIB
  • LYNX
  • SED
  • XSLTPROC
  • XMLLINT
  • ASCIIDOC
  • PythonInterp

– The following REQUIRED packages have been found:

  • PowerShell
  • GLIB2
  • GTHREAD2
  • LEX
  • YACC

– The following OPTIONAL packages have not been found:

– Configuring done – Generating done – Build files have been written to: E:/WShark/Build

asked 13 Jan ‘16, 04:34

Anazz's gravatar image

Anazz
6113
accept rate: 0%

edited 13 Jan ‘16, 20:52

Please post the output of your CMake generation step, e.g. redirect the output to a file ( cmake … > cmake.txt) and post the file’s contents here as a comment under your question.

Flex is normally installed as the Cygwin package flex.

(13 Jan ‘16, 05:45) grahamb ♦

Under cygwin package, flex version was 2.5.4. So I had to install 2.5.37 separately

(13 Jan ‘16, 19:45) Anazz

@grahamb: Added the output of CMake generation step

(13 Jan ‘16, 20:53) Anazz

The CMake output looks OK, although I haven’t personally used the Gnuwin32 fle and bison packages. My cygwin flex is 2.5.39, why was there an issue with 2.5.4?

I note from your question:

I downloaded the source code(2.0.1) from downloads

so does that mean you used a source tarball rather than git? If so then you may have hit on a “bad” version, can you try to download the sources using git clone as described in the Developers Guide?

(14 Jan ‘16, 00:38) grahamb ♦

@grahamb: Yes, I downloaded manually.But it was specified as a stable release. In flex 2.5.4, the option –header-file to specify output header file is not supported which gave me undefined flag error.

(14 Jan ‘16, 02:03) Anazz

Also, In the generated .h file, #undef YY_NEW_FILE and #undef YY_DO_BEFORE_ACTION is set. Commenting these two lines gives me a successful build. It is something related to flex it seems. Already reported here [http://sourceforge.net/p/flex/mailman/message/21495862/]

(14 Jan ‘16, 02:04) Anazz

Running lex involves some funky stuff, it’s not run directly, but via the bash script tools\runlex.sh.

No-one else has reported this issue so either:

  1. There is an issue with using the GnuWin32 flex, but no-one else is using it so the issue is unknown (till now).
  2. There is something different in your environment.
(14 Jan ‘16, 04:22) grahamb ♦
showing 5 of 7 show 2 more comments