ghpr-asia / wsdf

Wireshark Dissector Framework
Apache License 2.0
16 stars 9 forks source link

Difficulties to compile on Windows / Generated plugin not detected by Wireshark. #16

Open prisme60 opened 5 months ago

prisme60 commented 5 months ago

Windows 11 CMake 3.29 Visual 2022 git 2.44.0 Wireshark Version 4.2.4 (v4.2.4-0-g1fe5bce8d665).

I launch a build of the UDP example.

PS C:\git\imp-plugin> cargo build
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling memchr v2.7.2
   Compiling cc v1.0.90
   Compiling regex-syntax v0.8.3
   Compiling pkg-config v0.3.30
   Compiling thiserror v1.0.58
   Compiling once_cell v1.19.0
   Compiling aho-corasick v1.1.3
   Compiling cmake v0.1.50
   Compiling quote v1.0.35
   Compiling syn v2.0.58
   Compiling epan-sys v0.1.0
   Compiling regex-automata v0.4.6
The following warnings were emitted during compilation:

warning: epan-sys@0.1.0: libwireshark was not found, will be built from source

error: failed to run custom build command for `epan-sys v0.1.0`

Caused by:
  process didn't exit successfully: `C:\git\imp-plugin\target\debug\build\epan-sys-c9deedc09acd6efb\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=WIRESHARK_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=WIRESHARK_STATIC
  cargo:rerun-if-env-changed=WIRESHARK_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=WIRESHARK_STATIC
  cargo:rerun-if-env-changed=WIRESHARK_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rustc-link-lib=dylib=wireshark
  cargo:warning=libwireshark was not found, will be built from source
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
  CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-msvc = None
  CMAKE_x86_64_pc_windows_msvc = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "C:\\Users\\christian.foucher\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\epan-sys-0.1.0\\wireshark" "-G" "Visual Studio 17 2022" "-Thost=x64" "-Ax64" "-DBUILD_androiddump=OFF" "-DBUILD_capinfos=OFF" "-DBUILD_captype=OFF" "-DBUILD_ciscodump=OFF" "-DBUILD_corbaidl2wrs=OFF" "-DBUILD_dcerpcidl2wrs=OFF" "-DBUILD_dftest=OFF" "-DBUILD_dpauxmon=OFF" "-DBUILD_dumpcap=OFF" "-DBUILD_editcap=OFF" "-DBUILD_etwdump=OFF" "-DBUILD_logray=OFF" "-DBUILD_mergecap=OFF" "-DBUILD_randpkt=OFF" "-DBUILD_randpktdump=OFF" "-DBUILD_rawshark=OFF" "-DBUILD_reordercap=OFF" "-DBUILD_sshdump=OFF" "-DBUILD_text2pcap=OFF" "-DBUILD_tfshark=OFF" "-DBUILD_tshark=OFF" "-DBUILD_wifidump=OFF" "-DBUILD_wireshark=OFF" "-DBUILD_xxx2deb=OFF" "-DCMAKE_INSTALL_PREFIX=C:\\git\\imp-plugin\\target\\debug\\build\\epan-sys-3c2006cd53a3c1a2\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=Debug"

  --- stderr
  CMake Error: The source directory "C:/Users/christian.foucher/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epan-sys-0.1.0/wireshark" does not exist.
  Specify --help for usage, or press the help button on the CMake GUI.
  thread 'main' panicked at C:\Users\christian.foucher\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.50\src\lib.rs:1098:5:

I saw in the github repository that there is a submodule : wireshark, but not in the cargo registry.

But If I manually launch the command on the crate registry, it doesn't work. It seems that I need to clone the repository on my computer.

PS C:\Users\christian.foucher\.cargo\registry\src\index.crates.io-6f17d22bba15001f\epan-sys-0.1.0> git submodule update --init --recursive wireshark            
fatal: not a git repository (or any of the parent directories): .git

Another solution ?

I have found another way to compile that seems to work.