Ask Your Question
0

Problem compiling under Windows

asked 2025-08-05 14:59:36 +0000

adhawkins gravatar image

updated 2025-08-07 19:58:22 +0000

Guy Harris gravatar image

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

edit retag flag offensive close merge delete

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

Chuckc gravatar imageChuckc ( 2025-08-05 15:06:40 +0000 )edit

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

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

Andy

adhawkins gravatar imageadhawkins ( 2025-08-05 15:11:07 +0000 )edit

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.

grahamb gravatar imagegrahamb ( 2025-08-05 15:16:03 +0000 )edit

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

adhawkins gravatar imageadhawkins ( 2025-08-05 15:20:21 +0000 )edit

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.

grahamb gravatar imagegrahamb ( 2025-08-05 15:26:14 +0000 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2025-08-05 15:36:04 +0000

adhawkins gravatar image

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

edit flag offensive delete link more

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]

adhawkins gravatar imageadhawkins ( 2025-08-05 15:39:23 +0000 )edit

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

adhawkins gravatar imageadhawkins ( 2025-08-05 15:47:01 +0000 )edit

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.

grahamb gravatar imagegrahamb ( 2025-08-05 16:27:34 +0000 )edit

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

adhawkins gravatar imageadhawkins ( 2025-08-05 18:59:38 +0000 )edit

A VM for Wireshark builds is the way -:)

grahamb gravatar imagegrahamb ( 2025-08-06 08:39:07 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2025-08-05 14:59:36 +0000

Seen: 58 times

Last updated: Aug 07