You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows编译Qt 6.7.0遇EGL/ECM模块配置错误求助

Windows编译Qt 6.7.0时EGL/ECM模块配置错误问题

问题概述

在Windows系统编译Qt 6.7.0源码包(qt-everywhere-src-6.7.0)时,无论是直接用CMake执行配置,还是通过configure.bat配置,均出现EGL/ECM模块相关错误:找不到ECMFindModuleHelpersStub.cmake文件,且提示ecm_find_package_version_check命令未知,导致配置失败。

操作步骤与错误日志

使用CMake配置的操作及错误

C:\qt-everywhere-src-6.7.0>md build

C:\qt-everywhere-src-6.7.0>cd build

C:\qt-everywhere-src-6.7.0\build>cmake .. -G "Ninja" -DCMAKE_INSTALL_PREFIX=C:\Qt\6.7.0 -DCMAKE_BUILD_TYPE=Release
-- The CXX compiler identification is MSVC 19.39.33523.0
-- The C compiler identification is MSVC 19.39.33523.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking dependencies of submodule 'qtbase'
-- Checking dependencies of submodule 'qtimageformats'
-- Checking dependencies of submodule 'qtlanguageserver'
-- Checking dependencies of submodule 'qtshadertools'
-- Checking dependencies of submodule 'qtsvg'
-- Checking dependencies of submodule 'qtdeclarative'
-- Checking dependencies of submodule 'qtquicktimeline'
-- Checking dependencies of submodule 'qtquick3d'
-- Checking dependencies of submodule 'qtmultimedia'
-- Checking dependencies of submodule 'qt3d'
-- Checking dependencies of submodule 'qt5compat'
-- Checking dependencies of submodule 'qtactiveqt'
-- Checking dependencies of submodule 'qtcharts'
-- Checking dependencies of submodule 'qtcoap'
-- Checking dependencies of submodule 'qtconnectivity'
-- Checking dependencies of submodule 'qtdatavis3d'
-- Checking dependencies of submodule 'qtgraphs'
-- Checking dependencies of submodule 'qtwebsockets'
-- Checking dependencies of submodule 'qthttpserver'
-- Checking dependencies of submodule 'qtserialport'
-- Checking dependencies of submodule 'qtpositioning'
-- Checking dependencies of submodule 'qtlocation'
-- Checking dependencies of submodule 'qttools'
-- Checking dependencies of submodule 'qtwebchannel'
-- Checking dependencies of submodule 'qtwebengine'
-- Checking dependencies of submodule 'qtdoc'
-- Checking dependencies of submodule 'qtgrpc'
-- Checking dependencies of submodule 'qtlottie'
-- Checking dependencies of submodule 'qtmqtt'
-- Checking dependencies of submodule 'qtnetworkauth'
-- Checking dependencies of submodule 'qtopcua'
-- Checking dependencies of submodule 'qtquick3dphysics'
-- Checking dependencies of submodule 'qtquickeffectmaker'
-- Checking dependencies of submodule 'qtremoteobjects'
-- Checking dependencies of submodule 'qtscxml'
-- Checking dependencies of submodule 'qtsensors'
-- Checking dependencies of submodule 'qtserialbus'
-- Checking dependencies of submodule 'qtspeech'
-- Checking dependencies of submodule 'qttranslations'
-- Checking dependencies of submodule 'qtvirtualkeyboard'
-- Checking dependencies of submodule 'qtwayland'
-- Checking dependencies of submodule 'qtwebview'
-- Configuring submodule 'qtbase'
-- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Release'
            -DCMAKE_C_FLAGS=/DWIN32 /D_WINDOWS
            -DCMAKE_C_FLAGS_DEBUG=/Zi /Ob0 /Od /RTC1
            -DCMAKE_C_FLAGS_RELEASE=/O2 /Ob2 /DNDEBUG
            -DCMAKE_C_FLAGS_RELWITHDEBINFO=/Zi /O2 /Ob1 /DNDEBUG
            -DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /EHsc
            -DCMAKE_CXX_FLAGS_DEBUG=/Zi /Ob0 /Od /RTC1
            -DCMAKE_CXX_FLAGS_RELEASE=/O2 /Ob2 /DNDEBUG
            -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=/Zi /O2 /Ob1 /DNDEBUG
            -DCMAKE_EXE_LINKER_FLAGS=/machine:x64
            -DCMAKE_C_STANDARD=11
            -DCMAKE_C_STANDARD_REQUIRED=ON
            -DCMAKE_CXX_STANDARD=17
            -DCMAKE_CXX_STANDARD_REQUIRED=ON
            -DCMAKE_MODULE_PATH:STRING=C:/qt-everywhere-src-6.7.0/qtbase/cmake/platforms
CMake Error at qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake:63 (include):
  include could not find requested file:

    C:/qt-everywhere-src-6.7.0/qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:156 (find_package)
  qtbase/src/gui/configure.cmake:36 (qt_find_package)
  qtbase/cmake/QtFeature.cmake:678 (include)
  qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)


CMake Error at qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake:67 (ecm_find_package_version_check):
  Unknown CMake command "ecm_find_package_version_check".
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:156 (find_package)
  qtbase/src/gui/configure.cmake:36 (qt_find_package)
  qtbase/cmake/QtFeature.cmake:678 (include)
  qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)


-- Configuring incomplete, errors occurred!

使用configure.bat配置的操作及错误

C:\qt-everywhere-src-6.7.0>md build

C:\qt-everywhere-src-6.7.0>cd build

C:\qt-everywhere-src-6.7.0\build>..\configure.bat
+ cd qtbase
+ C:\qt-everywhere-src-6.7.0\qtbase\configure.bat -top-level
The system cannot find the drive specified.
The system cannot find the drive specified.
-- Windows 10 SDK version: 10.0.22000.0
'C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-G' 'Ninja' 'C:/qt-everywhere-src-6.7.0'
-- The CXX compiler identification is MSVC 19.39.33523.0
-- The C compiler identification is MSVC 19.39.33523.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking dependencies of submodule 'qtbase'
-- Checking dependencies of submodule 'qtimageformats'
-- Checking dependencies of submodule 'qtlanguageserver'
-- Checking dependencies of submodule 'qtshadertools'
-- Checking dependencies of submodule 'qtsvg'
-- Checking dependencies of submodule 'qtdeclarative'
-- Checking dependencies of submodule 'qtquicktimeline'
-- Checking dependencies of submodule 'qtquick3d'
-- Checking dependencies of submodule 'qtmultimedia'
-- Checking dependencies of submodule 'qt3d'
-- Checking dependencies of submodule 'qt5compat'
-- Checking dependencies of submodule 'qtactiveqt'
-- Checking dependencies of submodule 'qtcharts'
-- Checking dependencies of submodule 'qtcoap'
-- Checking dependencies of submodule 'qtconnectivity'
-- Checking dependencies of submodule 'qtdatavis3d'
-- Checking dependencies of submodule 'qtgraphs'
-- Checking dependencies of submodule 'qtwebsockets'
-- Checking dependencies of submodule 'qthttpserver'
-- Checking dependencies of submodule 'qtserialport'
-- Checking dependencies of submodule 'qtpositioning'
-- Checking dependencies of submodule 'qtlocation'
-- Checking dependencies of submodule 'qttools'
-- Checking dependencies of submodule 'qtwebchannel'
-- Checking dependencies of submodule 'qtwebengine'
-- Checking dependencies of submodule 'qtdoc'
-- Checking dependencies of submodule 'qtgrpc'
-- Checking dependencies of submodule 'qtlottie'
-- Checking dependencies of submodule 'qtmqtt'
-- Checking dependencies of submodule 'qtnetworkauth'
-- Checking dependencies of submodule 'qtopcua'
-- Checking dependencies of submodule 'qtquick3dphysics'
-- Checking dependencies of submodule 'qtquickeffectmaker'
-- Checking dependencies of submodule 'qtremoteobjects'
-- Checking dependencies of submodule 'qtscxml'
-- Checking dependencies of submodule 'qtsensors'
-- Checking dependencies of submodule 'qtserialbus'
-- Checking dependencies of submodule 'qtspeech'
-- Checking dependencies of submodule 'qttranslations'
-- Checking dependencies of submodule 'qtvirtualkeyboard'
-- Checking dependencies of submodule 'qtwayland'
-- Checking dependencies of submodule 'qtwebview'
-- Configuring submodule 'qtbase'
-- [QtBase] Setting build type to 'Release' as none was specified.
            -DCMAKE_C_FLAGS=/DWIN32 /D_WINDOWS
            -DCMAKE_C_FLAGS_DEBUG=/Zi /Ob0 /Od /RTC1
            -DCMAKE_C_FLAGS_RELEASE=/O2 /Ob2 /DNDEBUG
            -DCMAKE_C_FLAGS_RELWITHDEBINFO=/Zi /O2 /Ob1 /DNDEBUG
            -DCMAKE_CXX_FLAGS=/DWIN32 /D_WINDOWS /EHsc
            -DCMAKE_CXX_FLAGS_DEBUG=/Zi /Ob0 /Od /RTC1
            -DCMAKE_CXX_FLAGS_RELEASE=/O2 /Ob2 /DNDEBUG
            -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=/Zi /O2 /Ob1 /DNDEBUG
            -DCMAKE_EXE_LINKER_FLAGS=/machine:x64
            -DCMAKE_C_STANDARD=11
            -DCMAKE_C_STANDARD_REQUIRED=ON
            -DCMAKE_CXX_STANDARD=17
            -DCMAKE_CXX_STANDARD_REQUIRED=ON
            -DCMAKE_MODULE_PATH:STRING=C:/qt-everywhere-src-6.7.0/qtbase/cmake/platforms
CMake Error at qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake:63 (include):
  include could not find requested file:

    C:/qt-everywhere-src-6.7.0/qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:156 (find_package)
  qtbase/src/gui/configure.cmake:36 (qt_find_package)
  qtbase/cmake/QtFeature.cmake:678 (include)
  qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)


CMake Error at qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake:67 (ecm_find_package_version_check):
  Unknown CMake command "ecm_find_package_version_check".
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:156 (find_package)
  qtbase/src/gui/configure.cmake:36 (qt_find_package)
  qtbase/cmake/QtFeature.cmake:678 (include)
  qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)


-- Configuring incomplete, errors occurred!
CMake Error at C:/qt-everywhere-src-6.7.0/qtbase/cmake/QtProcessConfigureArgs.cmake:1077 (message):
  CMake exited with code 1.

当前使用的CMake版本

C:\qt-everywhere-src-6.7.0\build>cmake --version
cmake version 3.28.0-msvc1

CMake suite maintained and supported by Kitware (kitware.com/cmake).       

解决方案

1. 校验源码完整性

检查源码包解压后的qtbase/cmake/3rdparty/extra-cmake-modules/find-modules/目录下是否存在ECMFindModuleHelpersStub.cmake文件。如果缺失,重新解压源码包(建议用7-Zip等工具,避免解压过程中文件丢失),或者重新下载Qt源码包并校验哈希值确保文件完整。

2. 跳过EGL相关模块或禁用EGL特性

Windows平台默认使用Direct3D作为图形后端,无需依赖EGL。可以通过以下方式跳过相关模块:

  • 使用configure.bat时添加参数:
    ..\configure.bat -skip qtwayland -no-egl
    
  • 使用CMake时添加参数:
    cmake .. -G "Ninja" -DCMAKE_INSTALL_PREFIX=C:\Qt\6.7.0 -DCMAKE_BUILD_TYPE=Release -DQT_FEATURE_egl=OFF -DQT_FEATURE_wayland=OFF
    

3. 清理构建目录后重新配置

删除当前的build目录,重新创建并进入,再执行配置命令,避免旧的缓存文件干扰。

4. 确认CMake版本兼容性

Qt 6.7.0要求CMake最低版本为3.25.1,当前使用的3.28.0符合要求,但如果问题仍存在,可以尝试使用Qt官方推荐的CMake版本(如3.26.x系列)。

内容的提问来源于stack exchange,提问作者rwallace

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 08:32:01