1、使用Visual Studio 2019 Preview版本
2、推荐使用Chocolatey( a native package manager for Windows)来安装大部分编译所需要的packages
期间会下载若干编译需要的packages,有些url国内难以访问,整个过程建议开代理
通过cmd安装
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
3、安装Qt
Wireshark Application用到了Qt windowing toolkit,到https://www.qt.io/download下载,安装过程中需选择 “msvc2017 64-bit” component(build wireshark时用到)。
4、安装Python3
可通过choco
PS$>choco install -y python3
5、安装Cygwin(windows平台上运行的unix模拟环境)
https://cygwin.com/install.html
安装过程中选择Install from Internet
在full选项中搜索并勾选如下需要的安装包:
• Archive / unzip
• Devel / bison
• Devel / flex
• Interpreters / perl
• Devel / patch
• Web / wget
• Utils/dos2unix
选择版本代替skip即可实现安装
将Cygwin目录的lib路径添加到path中
6、安装Perl
https://www.activestate.com/
或者通过choco
PS$>choco install -y activeperl
7、安装CMake
https://cmake.org/download/
安装好后要将cmake.exe添加到path中
或者通过choco
PS$>choco install -y cmake
Chocolatey会帮你添加到path
8、安装Asciidoctor, Xsltproc, And DocBook(可选 to generate the documenation you’re reading and the User’s Guide)
easiest way
PS$>choco install -y asciidoctorj xsltproc docbook-bundle
9、安装winflexbison
https://sourceforge.net/projects/winflexbison/
将win_flex.exe和win_bison.exe的路径添加到path中
或通过choco
PS$>choco install -y winflexbison
Chocolatey会帮你添加到path
10、获取 prepared wireshark git repository
cd C:\example
git clone https://github.com/JuergenKosel/wireshark.git wireshark
git clone https://github.com/JuergenKosel/s7commwireshark
mkdir C:\example\compilation
将s7commwireshark路径下的src复制到wireshark/epan/dissectors/s7commwireshark路径下保存
11、Visual Studio Command Prompt
在Visual Studio路径下找到“x64 Native Tools Command Prompt for VS 2019”(开始菜单中)并打开
tip:可以固定在任务栏方便下次使用
设置此次build的环境变量:
> set WIRESHARK_BASE_DIR=C:\example
> set QT5_BASE_DIR=C:\Qt\5.12.5\msvc2017_64
其中Qt的版本号实际安装的版本号
每次重新打开Command Prompt都要重设环境变量
12、生成build files
cd C:\example\compilation
cmake -G "Visual Studio 16 2019" ..\wireshark
若generation成功会显示
-- Configuring done
-- Generating done
-- Build files have been written to: C:/
13、build wiresahrk
> msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln
编译过程持续大概10分钟
路径为C:\example\compilation\run\RelWithDebInfo\Wireshark.exe
14、s7commwireshark\doc\test-traces路径下有示例pcap文件
可用来测试s7comm_plus协议的解析