QT 5.7 MSVC 2015静态构建不工作

QT 5.7 MSVC 2015 Static Builds Not Working

本文关键字:构建 工作 静态 2015 MSVC QT      更新时间:2023-10-16

我在Windows上使用我的QT 5.7 MSVC 2015静态构建(32位和64位)有麻烦。以下是我运行的命令和得到的输出(也用32位进行了测试):

C:UsersJosh>set PATH=C:QtstaticQt 5.7.0 MSVC2015_Static_x64bin;%PATH%
C:UsersJosh>cd "UsersJoshMozy SyncReplicatorNewReplicatorNew"
C:UsersJoshMozy SyncReplicatorNewReplicatorNew>qmake ReplicatorNew.pro
Could not find qmake configuration file win32-msvc2015.
Error processing project file: ReplicatorNew.pro
以下是我配置QT静态构建的步骤:
  1. 下载QT 5.7源代码并解压缩到自己的目录。
  2. 安装QT与QT Creator和msvc2015 32和64位。
  3. 安装Visual Studio 2015社区与所有的Visual c++选项检查。
  4. 安装草莓Perl 32位并添加到路径。
  5. 安装Python 2.7.12并添加到path.
  6. 安装Ruby并添加到路径。
  7. 安装了Windows 10 SDK并勾选了install中的所有选项。
  8. 安装到自己的目录
  9. 下载openssl源代码并按这里构建。
  10. 将qtbasemkspecscommonmsvc-desktop.conf编辑为以下内容:

     QMAKE_CFLAGS_RELEASE    = -O2 -MT
     QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
     QMAKE_CFLAGS_DEBUG      = -Zi -MTd
    
  11. run this for 32 bit:

     cd "Program Files (x86)Microsoft Visual Studio 14.0vc"
     vcvarsall.bat x86
    
  12. 64位:

     cd "Program Files (x86)Microsoft Visual Studio 14.0vc"
     vcvarsall.bat amd64
    
  13. 这些:

     set QMAKESPEC=win32-msvc2015
     set QTDIR=C:QtStaticqt-everywhere-enterprise-src-5.7.0qtbase
     set PATH=C:QtStaticqt-everywhere-enterprise-src-5.7.0qtbasebin;%PATH%
     cd C:QtStaticqt-everywhere-enterprise-src-5.7.0
    
  14. 对于32位:

     configure -debug-and-release -confirm-license -platform win32-msvc2015 -opengl desktop -static -target xp -nomake examples -no-compile-examples -nomake tests -prefix C:QtstaticMSVC2015_Static_x86 -openssl -L C:OpenSSL-win32lib -l libeay32 -l ssleay32 -I C:OpenSSL-win32include -qt-libpng -qt-libjpeg -qt-zlib
    
  15. 对于64位:

     configure -debug-and-release -confirm-license -platform win32-msvc2015 -opengl desktop -static -nomake examples -no-compile-examples -nomake tests -prefix C:QtstaticMSVC2015_Static_x64 -openssl -L C:OpenSSL-win64lib -l libeay32 -l ssleay32 -I C:OpenSSL-win64include -qt-libpng -qt-libjpeg -qt-zlib
    
  16. 然后运行这些:

     C:Qtstaticjom_1_1_1jom.exe -j 4
     C:Qtstaticjom_1_1_1jom.exe -j 4 install
    

还明确验证了win32-msvc2015在静态构建目录的mkspecs目录中。我将qt静态文件重命名为第一个代码片段中的名称。我在谷歌上找不到太多,所以我在这里发帖,希望能有所帮助。谢谢。我希望它很简单,就像我留了一个目录放在路径环境变量中。

原来的问题是我重命名QT静态构建目录后的构建,这打破了它。快速修复:将其重命名为原始的configure -prefix名称。谢谢库巴地毯!