使用CMake编译ParaView源码遇Qt6 Core5Compat组件缺失错误的解决咨询
解决CMake编译ParaView时Qt6 Core5Compat组件缺失的问题
错误信息
CMake Warning at VTK/CMake/vtkModule.cmake:4810 (find_package): Found package configuration file: C:/Qt/6.6.0/mingw_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find required Qt component "Core5Compat". Expected Config file at "C:/Qt/6.6.0/mingw_64/lib/cmake/Qt6Core5Compat/Qt6Core5CompatConfig.cmake" does NOT exist Configuring with --debug-find-pkg=Qt6Core5Compat might reveal details why the package was not found. Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some of the path variables that find_package uses to try and find the package. Call Stack (most recent call first): Qt/Widgets/CMakeLists.txt:94 (vtk_module_find_package) CMake Error at VTK/CMake/vtkModule.cmake:4816 (message): Could not find the Qt6 external dependency. Call Stack (most recent call first): Qt/Widgets/CMakeLists.txt:94 (vtk_module_find_package).
解决步骤
补装Qt6 Core5Compat组件
- 打开Qt安装目录下的
MaintenanceTool.exe(比如C:\Qt\MaintenanceTool.exe) - 选择「添加或移除组件」,找到
Qt 6.6.0->MinGW 64-bit,展开「Additional Libraries」,勾选「Qt 5 Compatibility Module」(该模块包含Core5Compat) - 完成安装,确认
C:/Qt/6.6.0/mingw_64/lib/cmake/Qt6Core5Compat路径存在,且包含Qt6Core5CompatConfig.cmake文件
- 打开Qt安装目录下的
清理CMake缓存并重新配置
- 删除之前生成的CMake构建目录中的所有文件(重点删除
CMakeCache.txt) - 重新运行CMake命令,可手动指定Qt6路径确保识别正确:
cmake -G "MinGW Makefiles" -DQt6_DIR=C:/Qt/6.6.0/mingw_64/lib/cmake/Qt6 ..
- 删除之前生成的CMake构建目录中的所有文件(重点删除
针对C#嵌入场景的额外注意
- 编译ParaView时,开启
PARAVIEW_BUILD_CSHARP_BINDINGS选项(如果CMake配置中有此选项),确保生成C#可用的绑定库 - 保持ParaView编译架构与C#项目一致(均为64位,对应使用的MinGW 64-bit工具链)
- 编译ParaView时,开启
内容的提问来源于stack exchange,提问作者mayssa
相关产品推荐
相关产品推荐

