Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Out of Tree Dissector Build Problems

I have successfully downloaded the source and compiled Wireshark from sources. The built executable runs. I followed the instructions here: https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWindows.html

I am now trying to compile the "out of tree" dissector example here: https://github.com/wireshark/wireshark/tree/master/doc/plugins.example

As recommended by the instructions, my wireshark source code is in c:\development\wireshark After compiling Wireshark, I now have a C:\Development\wsbuild64 directory too. I have copied the plugin.example code out of the wireshark tree, so I also have a C:\Development\plugins.example directory. I have created a build directory beneath the plugin.example directory, so I also have a C:\Development\plugins.example\build. I believe this is what https://github.com/wireshark/wireshark/blob/master/doc/plugins.example/README is suggesting, though it is not entirely clear to me. I then execute

C:\Development\plugins.example\build>cmake -DCMAKE_PREFIX_PATH="C:\Development\wsbuild64" ..

The first hurdle I had to get past (alluded to in C:\Development\wsbuild64\WiresharkConfig.cmake was to create an empty folder so that cmake doesn't error out: I created C:\Development\include\wireshark - I hope this is right.

From WiresharkConfig.cmake...

set_and_check(Wireshark_INCLUDE_DIR        "${PACKAGE_PREFIX_DIR}/include/wireshark")
#
# set_and_check() cannot be used with directories that may or may not exist.
# If no plugins or extcaps are built the respective directories will not exist in the target
# system and set_and_check() and therefore find_package() will fail with a FATAL_ERROR,
# which is not helpful because the variable is correct, it's just that the empty directories
# were not created (also correctly, empty directories are just noise).
#

However, after getting this far, I appear to have one or possibly two further errors that I am unable to fix...

C:\Development\plugins.example\build>cmake -DCMAKE_PREFIX_PATH="C:\Development\wsbuild64" ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33813.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at C:/Development/wsbuild64/WiresharkConfig.cmake:50 (include):
  include could not find requested file:

    C:/Development/wsbuild64/WiresharkTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Configuring incomplete, errors occurred!

C:\Development\plugins.example\build>

The first...

include could not find requested file:
C:/Development/wsbuild64/WiresharkTargets.cmake

... I am not sure whether this is a fatal error or really a warning, as the script continues and another error is given...

-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Configuring incomplete, errors occurred!

This is where the script stops.

I will be just fine actually writing the dissector code, but have no experience of cmake or this build environment. Can anyone shed some light on what to do next or what I am doing wrong? I just want to get to the stage where I can compile a single dissector c file out of tree while developing. I'll eventually compile it 'in tree' and hopefully submit it for inclusion in Wireshark.

I have it working in LUA now (which I had to learn for this project!), so I'm not too far away! If anyone is interested, it is a dissector for Wahoo Direct Connect protocol, which is Bluetooth BLE packets sent over TCP, used by fitness equipment, such as exercise bikes and software such as Zwift.

Out of Tree Dissector Build Problems

I have successfully downloaded the source and compiled Wireshark from sources. The built executable runs. I followed the instructions here: https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWindows.html

I am now trying to compile the "out of tree" dissector example here: https://github.com/wireshark/wireshark/tree/master/doc/plugins.example

As recommended by the instructions, my wireshark source code is in c:\development\wireshark After compiling Wireshark, I now have a C:\Development\wsbuild64 directory too. I have copied the plugin.example code out of the wireshark tree, so I also have a C:\Development\plugins.example directory. I have created a build directory beneath the plugin.example directory, so I also have a C:\Development\plugins.example\build. I believe this is what https://github.com/wireshark/wireshark/blob/master/doc/plugins.example/README is suggesting, though it is not entirely clear to me. I then execute

C:\Development\plugins.example\build>cmake -DCMAKE_PREFIX_PATH="C:\Development\wsbuild64" ..

The first hurdle I had to get past (alluded to in C:\Development\wsbuild64\WiresharkConfig.cmake was to create an empty folder so that cmake doesn't error out: I created C:\Development\include\wireshark - I hope this is right.

From WiresharkConfig.cmake...

set_and_check(Wireshark_INCLUDE_DIR        "${PACKAGE_PREFIX_DIR}/include/wireshark")
#
# set_and_check() cannot be used with directories that may or may not exist.
# If no plugins or extcaps are built the respective directories will not exist in the target
# system and set_and_check() and therefore find_package() will fail with a FATAL_ERROR,
# which is not helpful because the variable is correct, it's just that the empty directories
# were not created (also correctly, empty directories are just noise).
#

However, after getting this far, I appear to have one or possibly two further errors that I am unable to fix...

C:\Development\plugins.example\build>cmake -DCMAKE_PREFIX_PATH="C:\Development\wsbuild64" ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33813.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at C:/Development/wsbuild64/WiresharkConfig.cmake:50 (include):
  include could not find requested file:

    C:/Development/wsbuild64/WiresharkTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Configuring incomplete, errors occurred!

C:\Development\plugins.example\build>

The first...

include could not find requested file:
C:/Development/wsbuild64/WiresharkTargets.cmake

... I am not sure whether this is a fatal error or really a warning, as the script continues and another error is given...

-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Configuring incomplete, errors occurred!

This is where the script stops.

I will be just fine actually writing the dissector code, but have no experience of cmake or this build environment. Can anyone shed some light on what to do next or what I am doing wrong? I just want to get to the stage where I can compile a single dissector c file out of tree while developing. I'll eventually compile it 'in tree' and hopefully submit it for inclusion in Wireshark.

I have it working in LUA now (which I had to learn for this project!), so I'm not too far away! If anyone is interested, it is a dissector for Wahoo Direct Connect protocol, which is Bluetooth BLE packets sent over TCP, used by fitness equipment, such as exercise bikes and software such as Zwift.