无法运行“qt-windows-static-build.ps1”适当地

发布于 2025-01-09 19:33:34 字数 6056 浏览 1 评论 0原文

我正在尝试为我的 QT Console 应用程序制作一个独立的可执行文件。所以我想出了 使用 MinGW 为 Windows 构建静态 Qt 并按照分步说明进行操作。 当我运行脚本时,它给了我下载 qt-everywhere-src.ps1 的错误,所以我手动下载 存档 并将其放置在适当的位置,即C:\Qt\Static\src 根据脚本。

然后我运行脚本,它给了我以下输出

Building static Qt version 6.2.3
Using MinGW from C:\Qt\Tools\mingw900_64
+ cd qtbase
+ C:\Qt\Static\src\qt-everywhere-src-6.2.3\qtbase\configure.bat -top-level -static -release -platform win32-g++ -opensource -confirm-license -prefix C:\Qt\Static\6.2.3 -qt-zlib -qt-libpng -qt-webp -qt-libjpeg -qt-freetype  -no-opengl -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtsensors -skip qtspeech -skip qtsvg -skip qtwayland -skip qtwebglplugin -skip qtwebview -skip webengine -make libs -nomake tools -nomake examples -nomake tests
-- Windows 10 SDK version:
opt: zlib val: qt
opt: libpng val: qt
Overriding option 'libpng' with 'qt' (was: 'undefined')
opt: webp val: qt
Overriding option 'webp' with 'qt' (was: 'undefined')
opt: libjpeg val: qt
Overriding option 'libjpeg' with 'qt' (was: 'undefined')
opt: freetype val: qt
Overriding option 'freetype' with 'qt' (was: 'undefined')
CMake Warning at qtbase/cmake/QtProcessConfigureArgs.cmake:247 (message):
  '-nomake tools' is not implemented yet.
Call Stack (most recent call first):
  qtbase/cmake/QtProcessConfigureArgs.cmake:782 (qtConfAddWarning)
  qtbase/cmake/QtProcessConfigureArgs.cmake:842 (check_qt_build_parts)


CMake Warning at qtbase/cmake/QtProcessConfigureArgs.cmake:247 (message):
  '-make libs' is not implemented yet.
Call Stack (most recent call first):
  qtbase/cmake/QtProcessConfigureArgs.cmake:782 (qtConfAddWarning)
  qtbase/cmake/QtProcessConfigureArgs.cmake:843 (check_qt_build_parts)


'C:/Program Files/CMake/bin/cmake.exe' '-DBUILD_qt3d=OFF' '-DBUILD_qtactiveqt=OFF' '-DBUILD_qtandroidextras=OFF' '-DBUILD_qtcharts=OFF' '-DBUILD_qtconnectivity=OFF' '-DBUILD_qtdatavis3d=OFF' '-DBUILD_qtdeclarative=OFF' '-DBUILD_qtdoc=OFF' '-DBUILD_qtgamepad=OFF' '-DBUILD_qtlocation=OFF' '-DBUILD_qtlottie=OFF' '-DBUILD_qtmacextras=OFF' '-DBUILD_qtmultimedia=OFF' '-DBUILD_qtnetworkauth=OFF' '-DBUILD_qtpurchasing=OFF' '-DBUILD_qtquick3d=OFF' '-DBUILD_qtquickcontrols=OFF' '-DBUILD_qtquickcontrols2=OFF' '-DBUILD_qtquicktimeline=OFF' '-DBUILD_qtremoteobjects=OFF' '-DBUILD_qtscript=OFF' '-DBUILD_qtsensors=OFF' '-DBUILD_qtspeech=OFF' '-DBUILD_qtsvg=OFF' '-DBUILD_qtwayland=OFF' '-DBUILD_qtwebglplugin=OFF' '-DBUILD_qtwebview=OFF' '-DBUILD_webengine=OFF' '-DBUILD_SHARED_LIBS=OFF' '-DCMAKE_INSTALL_PREFIX=C://Qt//Static//6.2.3' '-DQT_QMAKE_TARGET_MKSPEC=win32-g++' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_system_zlib=no' '-DINPUT_libpng=qt' '-DINPUT_webp=qt' '-DINPUT_libjpeg=qt' '-DINPUT_freetype=qt' '-DINPUT_opengl=no' '-G' 'MinGW Makefiles' 'C:/Qt/Static/src/qt-everywhere-src-6.2.3'
CMake Warning at qtbase/cmake/QtAutoDetect.cmake:65 (message):
  The officially supported CMake generator for building Qt is Ninja.  You are
  using: 'MinGW Makefiles' instead.  Thus, you might encounter issues.  Use
  at your own risk.
Call Stack (most recent call first):
  qtbase/cmake/QtAutoDetect.cmake:439 (qt_auto_detect_cmake_generator)
  CMakeLists.txt:11 (include)


Checking dependencies of 'qtbase'
Checking dependencies of 'qtshadertools'
Checking dependencies of 'qtimageformats'
Checking dependencies of 'qtcoap'
Checking dependencies of 'qttools'
Skipping optional dependency 'qtactiveqt' of 'qttools', because building 'qtactiveqt' was explicitly disabled.
Skipping optional dependency 'qtdeclarative' of 'qttools', because building 'qtdeclarative' was explicitly disabled.
Checking dependencies of 'qtserialport'
Checking dependencies of 'qtpositioning'
Skipping optional dependency 'qtdeclarative' of 'qtpositioning', because building 'qtdeclarative' was explicitly disabled.
Checking dependencies of 'qtscxml'
CMake Error at CMakeLists.txt:81 (message):
  Module 'qtscxml' depends on 'qtdeclarative', but building 'qtdeclarative'
  was explicitly disabled.

  Note: Use '-skip qtscxml' to exclude it from the build.

-- Configuring incomplete, errors occurred!

See also "C:/Qt/Static/src/qt-everywhere-src-6.2.3/CMakeFiles/CMakeOutput.log".
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:947 (message):
  CMake exited with code 1.


mingw32-make: *** No targets specified and no makefile found.  Stop.
mingw32-make: *** No rule to make target 'install'.  Stop.
Out-File : Could not find a part of the path 'C:\Qt\Static\6.2.3\mkspecs\win32-g++\qmake.conf'.
At C:\users\john\Desktop\qt_StaticBuid.ps1:167 char:6
+ "@ | Out-File -Append $File -Encoding Ascii
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

这些行表明“qtdeclarative”有问题,即

Module 'qtscxml' depends on 'qtdeclarative', but building 'qtdeclarative'
was explicitly disabled.

Note: Use '-skip qtscxml' to exclude it from the build.

所以我尝试使用 -skip qtscxml 选项,它给了我其他模块以继续跳过。

如何解决这个问题?

我没有对脚本进行任何更改。只需编辑这两行即可满足

$QtSrcUrl = "https://download.qt.io/official_releases/qt/6.2/6.2.3/single/qt-everywhere-src-6.2.3.zip"
$QtVersion = "6.2.3", #If you change this, you'll need to change the URL above to download as well...

我使用 QT Creator 5.0.2 以及 6.2.3 MinGW6.2.3 版本

I'm trying to make a standalone executable for my QT Console application. So i figured out Building a static Qt for Windows using MinGW and followed step by step instructions.
When i ran the script, it gave me errors for downloading qt-everywhere-src.ps1 so I manually download the archive and placed it in the appropriate location i.e. C:\Qt\Static\src as per the script.

Then I ran the script and it gave me the below output

Building static Qt version 6.2.3
Using MinGW from C:\Qt\Tools\mingw900_64
+ cd qtbase
+ C:\Qt\Static\src\qt-everywhere-src-6.2.3\qtbase\configure.bat -top-level -static -release -platform win32-g++ -opensource -confirm-license -prefix C:\Qt\Static\6.2.3 -qt-zlib -qt-libpng -qt-webp -qt-libjpeg -qt-freetype  -no-opengl -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtsensors -skip qtspeech -skip qtsvg -skip qtwayland -skip qtwebglplugin -skip qtwebview -skip webengine -make libs -nomake tools -nomake examples -nomake tests
-- Windows 10 SDK version:
opt: zlib val: qt
opt: libpng val: qt
Overriding option 'libpng' with 'qt' (was: 'undefined')
opt: webp val: qt
Overriding option 'webp' with 'qt' (was: 'undefined')
opt: libjpeg val: qt
Overriding option 'libjpeg' with 'qt' (was: 'undefined')
opt: freetype val: qt
Overriding option 'freetype' with 'qt' (was: 'undefined')
CMake Warning at qtbase/cmake/QtProcessConfigureArgs.cmake:247 (message):
  '-nomake tools' is not implemented yet.
Call Stack (most recent call first):
  qtbase/cmake/QtProcessConfigureArgs.cmake:782 (qtConfAddWarning)
  qtbase/cmake/QtProcessConfigureArgs.cmake:842 (check_qt_build_parts)


CMake Warning at qtbase/cmake/QtProcessConfigureArgs.cmake:247 (message):
  '-make libs' is not implemented yet.
Call Stack (most recent call first):
  qtbase/cmake/QtProcessConfigureArgs.cmake:782 (qtConfAddWarning)
  qtbase/cmake/QtProcessConfigureArgs.cmake:843 (check_qt_build_parts)


'C:/Program Files/CMake/bin/cmake.exe' '-DBUILD_qt3d=OFF' '-DBUILD_qtactiveqt=OFF' '-DBUILD_qtandroidextras=OFF' '-DBUILD_qtcharts=OFF' '-DBUILD_qtconnectivity=OFF' '-DBUILD_qtdatavis3d=OFF' '-DBUILD_qtdeclarative=OFF' '-DBUILD_qtdoc=OFF' '-DBUILD_qtgamepad=OFF' '-DBUILD_qtlocation=OFF' '-DBUILD_qtlottie=OFF' '-DBUILD_qtmacextras=OFF' '-DBUILD_qtmultimedia=OFF' '-DBUILD_qtnetworkauth=OFF' '-DBUILD_qtpurchasing=OFF' '-DBUILD_qtquick3d=OFF' '-DBUILD_qtquickcontrols=OFF' '-DBUILD_qtquickcontrols2=OFF' '-DBUILD_qtquicktimeline=OFF' '-DBUILD_qtremoteobjects=OFF' '-DBUILD_qtscript=OFF' '-DBUILD_qtsensors=OFF' '-DBUILD_qtspeech=OFF' '-DBUILD_qtsvg=OFF' '-DBUILD_qtwayland=OFF' '-DBUILD_qtwebglplugin=OFF' '-DBUILD_qtwebview=OFF' '-DBUILD_webengine=OFF' '-DBUILD_SHARED_LIBS=OFF' '-DCMAKE_INSTALL_PREFIX=C://Qt//Static//6.2.3' '-DQT_QMAKE_TARGET_MKSPEC=win32-g++' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_system_zlib=no' '-DINPUT_libpng=qt' '-DINPUT_webp=qt' '-DINPUT_libjpeg=qt' '-DINPUT_freetype=qt' '-DINPUT_opengl=no' '-G' 'MinGW Makefiles' 'C:/Qt/Static/src/qt-everywhere-src-6.2.3'
CMake Warning at qtbase/cmake/QtAutoDetect.cmake:65 (message):
  The officially supported CMake generator for building Qt is Ninja.  You are
  using: 'MinGW Makefiles' instead.  Thus, you might encounter issues.  Use
  at your own risk.
Call Stack (most recent call first):
  qtbase/cmake/QtAutoDetect.cmake:439 (qt_auto_detect_cmake_generator)
  CMakeLists.txt:11 (include)


Checking dependencies of 'qtbase'
Checking dependencies of 'qtshadertools'
Checking dependencies of 'qtimageformats'
Checking dependencies of 'qtcoap'
Checking dependencies of 'qttools'
Skipping optional dependency 'qtactiveqt' of 'qttools', because building 'qtactiveqt' was explicitly disabled.
Skipping optional dependency 'qtdeclarative' of 'qttools', because building 'qtdeclarative' was explicitly disabled.
Checking dependencies of 'qtserialport'
Checking dependencies of 'qtpositioning'
Skipping optional dependency 'qtdeclarative' of 'qtpositioning', because building 'qtdeclarative' was explicitly disabled.
Checking dependencies of 'qtscxml'
CMake Error at CMakeLists.txt:81 (message):
  Module 'qtscxml' depends on 'qtdeclarative', but building 'qtdeclarative'
  was explicitly disabled.

  Note: Use '-skip qtscxml' to exclude it from the build.

-- Configuring incomplete, errors occurred!

See also "C:/Qt/Static/src/qt-everywhere-src-6.2.3/CMakeFiles/CMakeOutput.log".
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:947 (message):
  CMake exited with code 1.


mingw32-make: *** No targets specified and no makefile found.  Stop.
mingw32-make: *** No rule to make target 'install'.  Stop.
Out-File : Could not find a part of the path 'C:\Qt\Static\6.2.3\mkspecs\win32-g++\qmake.conf'.
At C:\users\john\Desktop\qt_StaticBuid.ps1:167 char:6
+ "@ | Out-File -Append $File -Encoding Ascii
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

These lines suggests that something is wrong with 'qtdeclarative' i.e.

Module 'qtscxml' depends on 'qtdeclarative', but building 'qtdeclarative'
was explicitly disabled.

Note: Use '-skip qtscxml' to exclude it from the build.

So I tried using -skip qtscxml option and it gives me others modules to keep skipping.

How to resolve this problem ?

I've not made changes in the script. just these two lines are edited to meet the 6.2.3 version

$QtSrcUrl = "https://download.qt.io/official_releases/qt/6.2/6.2.3/single/qt-everywhere-src-6.2.3.zip"
$QtVersion = "6.2.3", #If you change this, you'll need to change the URL above to download as well...

I'm using QT Creator 5.0.2 along with 6.2.3 MinGW

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文