Windows Wireshark 3.4.4 build fails with Qt errors

I successfully built wireshark from source on Linux.

I copied the same source to the Windows 10 machine.

I followed the instructions given at

https://www.wireshark.org/docs/wsdg_h...

I downloaded Qt 5.15.4 using the Qt online installer and then set QT5_BASE_DIR=C:\Qt\5.15.4\5.15.4\msvc2019

The cmake was successful.

The build failed with 1000+ qt unresolved external reference errors.

Examples: error LNK2001: unresolved external symbol "public: static struct QMetaObject unresolved external symbol "public: static struct QMetaObject const AboutDialog::staticMetaObject"

I've had great success using the older gtk builds using autotools but this has become a road block.

edit retag close merge delete

The 3.4.x release builds are built with Qt 5.15.2, and the env var set to C:\Qt\5.15.2\msvc2019_64.

You're using a newer version, which may or may not cause issues, your path is a little different and you have no _x64 suffix, are you building a 32 bit or 64 bit version of Wireshark?

( 2021-06-15 08:17:52 +0000 )edit

The path is a little different because the Qt online installer set up the location in that way. I matched the path ending with msvc2019. The version the Qt online installer put on the system did not distinguish between x32 and x64. I tried it using the x64 Native Command Window to do the cmake and build, and when that didn't work the x86. Both failed with the same Qt link errors.

( 2021-06-15 21:56:40 +0000 )edit

I think you should ascertain exactly which Qt version (64 or 32 bit) you have, delete your build directory and then re-run the CMake generation step specifying the correct architecture.

Looking into it a bit more it seems that 5.15.4 is a "commercial" licence version, 5.15.2 is the latest open source licence. I'm not aware of anyone using the "commercial" licence versions when building Wireshark so you may be on the "bleeding edge" here.

( 2021-06-16 10:12:48 +0000 )edit

Sort by » oldest newest most voted

Success.

1. Downloaded Qt 5.15.2 and made sure I selected the 32bit version. This because the setup instructions called out for cmake with "-A Win32" option. 64 bit would work too, but if you commit to one or the other be sure to be consistent and match all the way through.

2. Since I committed to x86 I made sure I used the VS2019 "x86 Native Command Prompt..."

3. Wireshark 3.4.4 FAILED again, so abandoned wireshark 3.4.4 and downloaded wireshark 3.4.5.

4. I already had the tools called out in the guide installed, so I confirmed all environment variables required by the guide were set and correct.

5. Executed cmake and msbuild and it worked.

6. Incidentals. I had to clear the "Platform" env var, and had to move the WIRESHARK_LIB_DIR outside of the build directory.

Question: How do you build the libs used to set the WIRESHARK_LIB_DIR env var? At some point during the trial and error phase of doing this I built the wireshark-win32-libs-3.4, but can't remember how I did it.

more

"The required libraries (apart from Qt) are automatically downloaded as part of the CMake generation step, and subsequently as required when libraries are updated.

The libraries are downloaded into the directory indicated by the environment variable WIRESHARK_BASE_DIR, this must be set appropriately for your environment. The libraries are downloaded and extracted into WIRESHARK_BASE_DIR\wireshark-win32-libs and WIRESHARK_BASE_DIR\wireshark-win64-libs for 32 and 64 bit builds respectively.

You may also directly set the library directory with the environment variable WIRESHARK_LIB_DIR, but if you switch between 32 bit and 64 bit builds, the value of this must be set appropriately."

( 2021-06-16 12:31:13 +0000 )edit

WIRESHARK_BASE_DIR is usually sufficient but some situations require WIRESHARK_LIB_DIR, e.g. if building older versions on a system where you normally build the stable or master, e.g. 3.2.x where you want those libs to go into a different lib dir.

( 2021-06-16 13:26:35 +0000 )edit

The WSDG probably needs an update for 32 bit builds. Most of the instructions are written around producing a 64 bit version, but the info on using msbuild then jumps to a 32 bit build. The msbuild command for a 32 bit version should be:

msbuild /m "/p:Configuration=RelWithDebInfo;Platform=Win32" Wireshark.sln


Note that the only point in building a 32 bit version is if your target deployment is 32-bit only or you're building the portable version, most folks are better off building the 64-bit version.

( 2021-06-16 13:50:50 +0000 )edit

@vemson The WSDG advises that WIRESHARK_BASE_DIR is set to C:\Development and the git repo and build dirs are contained in that dir, along with the lib directories giving rise to a layout like:

C:\Development
\wireshark - the git source repo
\wireshark-win32-libs - the 3rd party libs for 32-bit builds
\wireshark-win64-libs - the 3rd party libs for 64-bit builds
\wsbuild32 - the build dir for 32-bit versions
\wsbuild64 - the build dir for 64-bit versions


Obviously you can set whatever structure you like, but if things then break you get to fix it yourself.

( 2021-06-16 14:03:30 +0000 )edit