Ask Your Question
0

Out of Tree Dissector Build Problems on Windows

asked 2024-08-01 21:01:21 +0000

SteveD gravatar image

updated 2024-08-08 15:04:27 +0000

grahamb gravatar image

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_h...

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

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/wireshar... 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 ... (more)

edit retag flag offensive close merge delete

Comments

You might read through 17237: wireshark/doc/plugins.example build problem

-- Building for: Visual Studio 17 2022


I'm not sure out of tree is possible on Windows.

Chuckc gravatar imageChuckc ( 2024-08-02 00:43:59 +0000 )edit

I did manage to get over the WiresharkConfig.cmake issue mentioned in this post, by using cmake -DCMAKE_PREFIX_PATH="C:\Development\wsbuild64", so I got further than the guy in this post I think.

Also, I think (though it's very hard to follow) he is trying to build without installing Wireshark. I have installed Wireshark. But maybe that doesn't give me what I need. It's hard for me to know. I am slowly joining the dots, but more dots keep appearing!

SteveD gravatar imageSteveD ( 2024-08-02 19:37:46 +0000 )edit

The goal is one of these - Package: wireshark-dev (4.2.6-1) - for Windows.
It's a mixture of static and build process generated files.

Chuckc gravatar imageChuckc ( 2024-08-02 20:26:02 +0000 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2024-08-07 19:52:50 +0000

SteveD gravatar image

I might have been able to discover the solution myself, but I made an incorrect assumption: I assumed that an 'out-of-tree' dissector build was synonymous with a plug-in DLL and that an 'in-tree' build was synonymous with a dissector compiled into the Wireshark executable. I can now see that this clearly isn't the case, since there are multiple 'in-tree' plug-in DLL dissectors within the source. So my issues around building an out-of-tree plug-in DLL were resolvable by building an in-tree plug-in - a combination that I assumed didn't exist. Apologies if my incorrect & interchangeable use of terminology has caused any confusion.

The solution to my problem is to base my plug-in dissector on an in-tree-built plug-in that already exists within the prepared source tree (wsbuild64).

Best regards

Steve

edit flag offensive delete link more
0

answered 2024-08-04 10:13:38 +0000

Anders gravatar image

The easiest is probably to edit CMakeListsCustom.txt.example in the top level dir and rename it CMakeListsCustom.txt I don't remember if anything else was needed to include the file.

edit flag offensive delete link more

Comments

That's for an in-tree build which apparently the OP doesn't want

grahamb gravatar imagegrahamb ( 2024-08-04 18:53:03 +0000 )edit

Stick it in the tree but only build the project for the plugin under developement.

C:\Development\wsbuild64\plugins\epan\gryphon>dir
...

 Directory of C:\Development\wsbuild64\plugins\epan\gryphon
...
08/01/2024  11:42 AM            38,962 gryphon.vcxproj
08/01/2024  11:42 AM             1,231 gryphon.vcxproj.filters

C:\Development\wsbuild64\plugins\epan\gryphon>msbuild /m /p:Configuration=RelWithDebInfo gryphon.vcxproj


Similar to the syntax used to build the WSDG/WSUG and the NSIS installer.

Chuckc gravatar imageChuckc ( 2024-08-06 20:13:47 +0000 )edit

That works from within VS2022 too and builds a DLL!

SteveD gravatar imageSteveD ( 2024-08-06 20:45:04 +0000 )edit
0

answered 2024-08-02 08:44:02 +0000

grahamb gravatar image

From the plugins.example

Note that the out-of-tree method builds the plugin using CMake's Config-file mechanism[1] for configuration. In other words the plugin build system uses the Wireshark headers that were installed on the system using "make install" or equivalent (as configured from WiresharkConfig.cmake). This is not the same as an in-tree build.

The Windows builds do not create a "headers" (or -dev) package so this is unlikely to work on Windows.

I would create a git branch in your repo (which should be from the canonical GitLab not GitHub repo) to contain your plug-in in-tree and sync the branch to master as required.

edit flag offensive delete link more

Comments

Comment on 17237:

To recap at the moment there is no SDK for macOS (with appbundle) or Windows (with installer).


Should doc/plugins.example/README be updated to exclude Mac and Windows from out of tree builds?

Chuckc gravatar imageChuckc ( 2024-08-02 11:43:06 +0000 )edit

Probably. Possibly created by balint who is a Linux person.

grahamb gravatar imagegrahamb ( 2024-08-02 11:48:47 +0000 )edit

The Windows builds do not create a "headers" (or -dev) package so this is unlikely to work on Windows.

Poking around in the Wireshark project from Visual Studio, I did find a 'CMake Predefined Target' called 'Install'. Could this be the equivalent of "make install" but for Windows? I ran it and it built a wireshark-x64-libs directory with 3822 files and folders, including many header files. It returned an error code of 1 with no message at the end, though I'm not sure if that's expected or not. Could this possibly be what I need?

Is "make install" and what it is meant to do explained anywhere? I have seen it mentioned a few times, but have not found a definition of what it does. From it's name "Install", I had assumed it was a command line method (non-Windows, which I don't have currently) to make ...(more)

SteveD gravatar imageSteveD ( 2024-08-02 20:13:03 +0000 )edit

One more reason to want an out of tree build: Reloading plugins is just Ctrl-Shift-L. Much simpler than closing wireshark, rebuilding wireshark, opening wireshark, opening capture file, then navigating to the right part of the file to see the effect of your code change.

SteveD gravatar imageSteveD ( 2024-08-02 20:31:52 +0000 )edit

The only way an out-of-tree build for Windows will happen is if someone puts in the time and effort to enable it. Please raise an enhancement request on the Wireshark GitLab instance.

I do think this is unlikely to ever happen as Wireshark has so many 3rd party dependencies, including the huge one of Qt, that a "-dev" package will be unwieldy. Good luck though.

grahamb gravatar imagegrahamb ( 2024-08-04 19:00:27 +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: 2024-08-01 21:01:21 +0000

Seen: 184 times

Last updated: Aug 08