技术控丶 2025-12-30 17:41 采纳率: 0%
浏览 2

编译Wireshark

在Windows 10中源码编译Wireshark,
按照你写的步骤,报如下错误,请问要怎么解决呢

C:\Development\wsbuild64>cmake -G "Visual Studio 16 2019" -A x64 ..\wireshark
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 6.2.9200.
-- Using 3rd party repository
-- Generating build using CMake 3.29.2
-- Added C:/Strawberry/c to CMAKE_IGNORE_PREFIX_PATH
-- Using "Visual Studio 16 2019" generator (multi-config)
-- LTO/IPO is not enabled
-- Building for x64
-- Artifacts up to date. Skipping download.
-- V: 4.7.0, MaV: 4, MiV: 7, PL: 0, EV: .
CMake Warning at CMakeLists.txt:665 (message):
  Windows SDK 10.0.19041.0 doesn't support C11.  Please make sure you're
  using 10.0.20348.0 or later.


-- Linker flags: /LARGEADDRESSAWARE /MANIFEST:NO /INCREMENTAL:NO /RELEASE /guard:cf /STACK:0x800000
-- Could NOT find Qt6Multimedia (missing: Qt6Multimedia_DIR)
CMake Warning at C:/Qt/6.5.3/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:214 (message):
  Failed to find optional Qt component "Multimedia".

  Expected Config file at
  "C:/Qt/6.5.3/msvc2019_64/lib/cmake/Qt6Multimedia/Qt6MultimediaConfig.cmake"
  does NOT exist

Call Stack (most recent call first):
  CMakeLists.txt:1399 (find_package)


-- Considering the following Lua versions: 5.4;5.3
-- Check size of LUA_INTEGER
-- Check size of LUA_INTEGER - done
-- No SSE4.2 compiler flag enabled
-- C-Flags:  /MP /W3 /bigobj /diagnostics:caret /Zo /utf-8 /guard:cf /w34295 /w34100 /w34189 /w34706 /wd4200 /wd5105 /DWIN32 /D_WINDOWS
-- CXX-Flags:  /MP /W3 /bigobj /diagnostics:caret /Zo /utf-8 /guard:cf /w34295 /w34100 /w34189 /w34706 /wd4200 /wd5105 /DWIN32 /D_WINDOWS /EHsc -Zc:__cplusplus
-- Warnings as errors enabled: /WX
-- The following OPTIONAL packages have been found:

 * Perl
 * Git
 * GMODULE2
 * LIBSSH (required version >= 0.8.5), Library for implementing SSH clients, <https://www.libssh.org/>
   extcap remote SSH interfaces (sshdump, ciscodump, wifidump, sshdig)
 * PCAP
 * Qt6CoreTools (required version >= 6.5.3)
 * Qt6Core (required version >= 6.2)
 * Qt6GuiTools (required version >= 6.5.3)
 * Qt6Gui (required version >= 6.2)
 * Qt6LinguistTools (required version >= 6.2)
 * Qt6WidgetsTools (required version >= 6.5.3)
 * Qt6PrintSupport (required version >= 6.2)
 * Qt6Concurrent (required version >= 6.2)
 * Qt6Core5Compat (required version >= 6.2)
 * Qt6DBusTools (required version >= 6.5.3)
 * Qt6DBus (required version >= 6.2)
 * WinSparkle
 * MaxMindDB, C library for the MaxMind DB file format, <https://github.com/maxmind/libmaxminddb>
   Support for GeoIP lookup
 * SMI, Library to access SMI management information, <https://www.ibr.cs.tu-bs.de/projects/libsmi/>
   Support MIB and PIB parsing and OID resolution
 * GNUTLS (required version >= 3.5.8)
 * KERBEROS
 * XXHASH, Extremely fast hash algorithm, <https://github.com/Cyan4973/xxHash/>
   Fast hashing
 * ZLIBNG
 * ZLIB
 * Minizipng, A fork of the minizip library - Mini zip and unzip based on zlib, <https://github.com/zlib-ng/minizip-ng>
   Support for profiles import/export
 * BROTLI
 * LZ4 (required version >= 1.8.0), LZ4 is a fast lossless compression algorithm, <http://www.lz4.org>
   LZ4 decompression in CQL and Kafka dissectors, read compressed capture files
 * SNAPPY, A fast compressor/decompressor from Google, <https://google.github.io/snappy/>
   Snappy decompression in Couchbase, CQL, Kafka and Mongo dissectors
 * ZSTD (required version >= 1.0.0), A compressor/decompressor from Facebook providing better compression than Snappy at a cost of speed, <https://facebook.github.io/zstd/>
   Zstd decompression in Kafka dissector, read compressed capture files
 * NGHTTP2 (required version >= 1.11.0), HTTP/2 C library and tools, <https://nghttp2.org>
   Header decompression in HTTP2
 * NGHTTP3, HTTP/3 C library and tools, <https://nghttp2.org>
   Header decompression in HTTP3
 * Lua, Lua is a powerful, efficient, lightweight, embeddable scripting language, <https://www.lua.org/>
   Lua allows writing dissectors and other extensions without a C/C++ compiler
 * SBC, Bluetooth low-complexity, subband codec (SBC) decoder, <https://git.kernel.org/pub/scm/bluetooth/sbc.git>
   Support for playing SBC codec in RTP player
 * SPANDSP, a library of many DSP functions for telephony, <https://www.soft-switch.org>
   Support for G.722 and G.726 codecs in RTP player
 * BCG729, G.729 decoder, <https://www.linphone.org/technical-corner/bcg729>
   Support for G.729 codec in RTP player
 * AMRNB, AMRNB decoder, <https://sourceforge.net/p/opencore-amr>
   Support for AMRNB codec in RTP player
 * ILBC, iLBC decoder, <https://github.com/TimothyGu/libilbc>
   Support for iLBC codec in RTP player
 * OPUS, opus decoder, <https://opus-codec.org/>
   Support for opus codec in RTP player
 * XSLTPROC
 * DOXYGEN
 * Asciidoctor (required version >= 1.5)

-- The following REQUIRED packages have been found:

 * Python3 (required version >= 3.6)
 * PowerShell
 * GLIB2 (required version >= 2.54.0)
 * GTHREAD2
 * GCRYPT (required version >= 1.8.0)
 * CARES (required version >= 1.13.0), Library for asynchronous DNS requests, <https://c-ares.org/>
   DNS name resolution for captures
 * LEX
 * PCRE2, Regular expression pattern matching using the same syntax and semantics as Perl 5, <https://www.pcre.org>
   Support for regular expressions
 * LibXml2 (required version >= 2.9.7)
 * Qt6 (required version >= 6.2)
 * SpeexDSP, SpeexDSP is a patent-free, Open Source/Free Software DSP library, <https://www.speex.org/>
   RTP audio resampling

-- The following OPTIONAL packages have not been found:

 * Qt6Multimedia (required version >= 6.2)

-- Configuring done (4.5s)
CMake Error in epan/CMakeLists.txt:
  Target "epan" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "C:/Development/wireshark/wireshark-x64-libs/vcpkg-export-2025.07.25-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:/Development/wireshark/wireshark-x64-libs/vcpkg-export-2025.07.25-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:/Development/wireshark/wireshark-x64-libs/vcpkg-export-2025.07.25-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:/Development/wireshark/wireshark-x64-libs/vcpkg-export-2025.07.25-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:/Development/wireshark/wireshark-x64-libs/libgcrypt-bundle-1.11.2-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:/Development/wireshark/wireshark-x64-libs/gnutls-3.8.11-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:/Development/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 (22.7s)

  • 写回答

2条回答 默认 最新

  • 紫雾凌寒 新星创作者: 人工智能技术领域 2025-12-30 17:41
    关注

    让 “紫雾凌寒” 来帮你回答,本回答结合 DeepSeek

    如果还有问题,请评论或点击头像私信,如果有帮助到您, 请关注、采纳、点赞

    1. 关键点分析
      - 从提供的信息“cmake -G “Visual Studio”来看,这只是一个不完整的cmake命令。完整的cmake命令应该指定Wireshark源码路径、生成器类型(如具体的Visual Studio版本)以及可能的其他参数。错误原因很可能是命令不完整,导致cmake无法正确执行。
    2. 解决方案
      - 假设Wireshark源码路径为C:\WiresharkSource,要使用Visual Studio 2019生成64位的项目文件,可以使用以下完整的cmake命令:
      cmake -G "Visual Studio 16 2019" -A x64 C:\WiresharkSource
      - 这里解释一下参数:
      • -G "Visual Studio 16 2019":指定使用Visual Studio 2019作为生成器。
      • -A x64:指定生成64位的项目文件。
      • C:\WiresharkSource:这是Wireshark源码的路径。
    3. 多种解决方案及优缺点
      - 方案一:正确补全cmake命令
      • 优点:简单直接,按照正确的语法格式补全命令即可解决当前问题。
      • 缺点:如果后续还有其他编译相关的问题,可能需要进一步排查cmake配置以及依赖项等其他方面。
      • 方案二:检查环境变量
      • 优点:从根本上解决编译问题,如果环境变量配置不正确,会影响整个编译流程,检查环境变量可以避免很多潜在问题。
      • 缺点:相对复杂一些,需要了解Wireshark编译所依赖的环境变量,如是否正确设置了编译器路径等,并且排查过程可能比较繁琐。
    4. 总结
      - 首先要确保cmake命令完整且正确,按照项目的要求指定合适的生成器和相关参数。如果补全命令后仍然报错,再进一步检查环境变量等其他可能影响编译的因素。

    请注意,以上步骤是基于常见的Wireshark编译问题解决思路,实际情况可能因Wireshark版本以及系统环境的差异而有所不同。

    希望以上解答对您有所帮助。如果您有任何疑问,欢迎在评论区提出。

    评论

报告相同问题?

问题事件

  • 创建了问题 12月30日