wireshark源码编译安装过程记录
前言
例如:wireshark是广泛使用的网络报文分析工具,适合分析各种网络协议。我在项目中经常用于分析someip、mqtt等协议,是排查网络问题的利器。对于linux下默认安装的wireshark版本太低,功能不全,所以我选择源码编译安装。
一、wireshark源码包的下载
从官网:https://www.wireshark.org/download.html,点击Source Code进行下载。我这里下载的是wireshark-4.0.8.tar.xz.
二、源码编译
1.执行以下命令
tar -xf wireshark-4.0.8.tar.xz
cd wireshark-4.0.8/
mkdir build
cd build/
cmake ..
有报错:CMake Error at CMakeLists.txt:1239 (find_package):
By not providing “FindQt5Core.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Qt5Core”, but
CMake did not find one.
Could not find a package configuration file provided by “Qt5Core” with any
of the following names:
Qt5CoreConfig.cmake
qt5core-config.cmake
Add the installation prefix of “Qt5Core” to CMAKE_PREFIX_PATH or set
“Qt5Core_DIR” to a directory containing one of the above files. If
“Qt5Core” provides a separate development package or SDK, be sure it has
been installed.
这里报错说明了没有找到Qt5Core相关的包。由于我的linux电脑apt安装qt5时,缺少各种依赖,没有安装成功。所以我选择源码安装qt5。
2. qt源码下载安装
从qt网站下载,可以参考:https://blog.csdn.net/lj19990824/article/details/121013721
,我这里使用的qt-opensource-linux-x64-5.12.10.run。这样qt5就能正常运行了。
3. 在CMAKE文件指定qt5的路径
在CMakeList.txt的1239行增加一行。
set(CMAKE_PREFIX_PATH "/home/zy/software/Qt5.12.10/5.12.10/gcc_64/lib/cmake")
保存后,再次执行
cmake ..
make -j
cd run/
./wireshark
打开了。可以正常使用了。
总结
解决wireshark编译的报错问题,如有相关问题欢迎交流。