This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

Problem compiling under Windows

asked Aug 05 '25

updated Aug 07 '25

I'm trying to build Wireshark under Windows in order to develop a dissector for a protocol.

During the CMake stage, I get the following messages:

CMake Error in epan/CMakeLists.txt:
  Target "epan" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/vcpkg-export-2025.04.09-x64-windows-ws/installed/x64-windows/include/glib-2.0"

  which is prefixed in the source directory.


CMake Error in epan/CMakeLists.txt:
  Target "epan" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/vcpkg-export-2025.04.09-x64-windows-ws/installed/x64-windows/lib/glib-2.0/include"

  which is prefixed in the source directory.


CMake Error in wsutil/CMakeLists.txt:
  Target "wsutil" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/vcpkg-export-2025.04.09-x64-windows-ws/installed/x64-windows/include/glib-2.0"

  which is prefixed in the source directory.


CMake Error in wsutil/CMakeLists.txt:
  Target "wsutil" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/vcpkg-export-2025.04.09-x64-windows-ws/installed/x64-windows/lib/glib-2.0/include"

  which is prefixed in the source directory.


CMake Error in wsutil/CMakeLists.txt:
  Target "wsutil" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/libgcrypt-bundle-1.11.1-1-x64-mingw-dynamic-ws/include"

  which is prefixed in the source directory.


CMake Error in wsutil/CMakeLists.txt:
  Target "wsutil" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/gnutls-3.8.10-1-x64-mingw-dynamic-ws/include"

  which is prefixed in the source directory.


CMake Error in wsutil/CMakeLists.txt:
  Target "wsutil" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Users/andy/source/repos/wireshark/wireshark-x64-libs/xxhash-0.8.3-1-x64-windows-ws/installed/x64-windows/include"

  which is prefixed in the source directory.


-- Generating done (3.7s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

I'm running the CMake command in c:\users\andy\source\repos\wireshark-build, and the wireshark source is in C:\Users\andy\source\repos\wireshark

Anyone tell me what I'm doing wrong?

Thanks

Andy

Comments

Has this ever worked or first time? What is the cmake command string you're running?

WSDG 2.2.1.12. Generate the build files

User 2763 ( Aug 05 '25 )

This is my first attempt. This is the command line:

C:\Users\andy\source\repos\wireshark

Andy

User 36329 ( Aug 05 '25 )

From the WSDG, sect. 2.2.1.11, sub item 2.

Create and change to the correct build directory. CMake is best used in an out-of-tree build configuration where the build is done in a separate directory from the source tree

You seem to have the build dir inside the git repo dir.

User 98587 ( Aug 05 '25 )

That was my first thought, but the build dir is:

cmake -G "Visual Studio 16 2019" -A x64 ..\wireshark

and the source dir is

C:\Users\andy\source\repos\wireshark

User 36329 ( Aug 05 '25 )

Ah, my mistake, you seem to have the third-party libs under the source directory, which I've never done but might be the issue. Normally there are three parallel dirs;

  • source
  • build
  • 3rd party libs

The latter path is set by the env var WIRESHARK_LIB_DIR.

User 98587 ( Aug 05 '25 )

17477: cmake generation fails

Your CMake source directory seems to be D:/Dev/cf_ref_times/wireshark. Can you please make sure the wireshark-win64-libs is not under the source or build directories and then report back if the issue persists. To be clear the libs directory should be something like D:/Dev/wireshark-win64-libs.

User 2763 ( Aug 05 '25 )

Ok, I'll try that. The build instructions suggest that way should work though:

rem Let CMake determine the library download directory name under
rem WIRESHARK_BASE_DIR or set it explicitly by using WIRESHARK_LIB_DIR.
rem Set *one* of these.
set WIRESHARK_BASE_DIR=C:\Development
rem set WIRESHARK_LIB_DIR=c:\wireshark-x64-libs
rem Set the Qt installation directory
set WIRESHARK_QT6_PREFIX_PATH=C:\Qt\6.8.1\msvc2022_64
rem Append a custom string to the package version. Optional.
set WIRESHARK_VERSION_EXTRA=-YourExtraVersionInfo
User 36329 ( Aug 05 '25 )

What is WIRESHARK_BASE_DIR and/ or WIRESHARK_LIB_DIR set to on your system?

User 2763 ( Aug 05 '25 )

1 Answer

0

answered Aug 05 '25

Ok, so the issue seemed to be that the third party libs were being built under the source directory. The build instructions at https://www.wireshark.org/docs/wsdg_h... should probably be updated to reflect this.

Thanks for the help. Let's hope the build completes successfully!

Andy

Comments

It doesn't. Getting lots of the following warnings, which are eventually treated as errors:

C:\Users\andy\source\repos\wireshark\epan\dissectors\packet-steam-ihs-discovery.c(408): warning C4706: assignment within conditional expression [C:\Users\andy\source\repos\wireshark-build\epan\dissectors\dissectors.vcxproj]

User 36329 ( Aug 05 '25 )

I've found the compiler flag that is treating these warnings as errors in the CMakeLists.txt file. I've removed it to see if it helps.

Andy

User 36329 ( Aug 05 '25 )

Probably unhelpful, but please take note of the warning at the start of the section (2.2.1) on building Wireshark in the Developers Guide:

Unless you know exactly what you are doing, you should strictly follow the recommendations below. They are known to work and if the build breaks, please re-read this guide carefully.

Changing build flags is likely to make things worse, if the guide is strictly followed you will successfully build Wireshark.

If, for reasons, you can't use the suggested top-level directory, i.e. C:\Development, then you can substitute that path with another as long as all other items use the new directory as the "root" of operations.

User 98587 ( Aug 05 '25 )

Ok, I'm going to spin up a clean Windows VM, and follow the guide to the letter. Will report back.

User 36329 ( Aug 05 '25 )

A VM for Wireshark builds is the way -:)

User 98587 ( Aug 06 '25 )

That would be useful I'm sure!

I ended up giving up on this, and going down the linux cross-compile route. I now have a custom build of 'master', and have added a skeleton plugin to it. Now on to the real work!

Thanks to all for the help thus far.

User 36329 ( Aug 06 '25 )

I meant that is the way I do Wireshark dev. I guess someone could create a VM image but as it would have a Windows OS, licensing and distribution might be an issue.

User 98587 ( Aug 06 '25 )

Ah apologies. I read it as 'is on the way'.

Seems fairly straightforward to use mingw under linux, so will proceed with that route for now.

User 36329 ( Aug 06 '25 )
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.