Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在VS2012下静态构建Qt 4.8/5.2,使用静态MSVC运行时,并支持Windows XP?_Qt_Visual Studio 2012_Qt4_Qt5 - Fatal编程技术网

如何在VS2012下静态构建Qt 4.8/5.2,使用静态MSVC运行时,并支持Windows XP?

如何在VS2012下静态构建Qt 4.8/5.2,使用静态MSVC运行时,并支持Windows XP?,qt,visual-studio-2012,qt4,qt5,Qt,Visual Studio 2012,Qt4,Qt5,我想在VS2012下对Qt 4.8/5.2进行完全静态的构建,包括静态运行库,并针对Windows XP系统。Qt不支持这种开箱即用的方式,因为即使是Qt的静态构建也使用动态链接的MSVC运行时 这将是一个规范问题,提供成功构建满足这些要求的Qt所需的知识。Qt 5.2 假设环境已准备好XP定位,相关XP定位qt5xp.patch和bug修复qt5fixes.patch可用-我们必须执行以下操作: 分别从qtbase/mkspecs/win32-msvc2012和qtbase/mkspecs/w

我想在VS2012下对Qt 4.8/5.2进行完全静态的构建,包括静态运行库,并针对Windows XP系统。Qt不支持这种开箱即用的方式,因为即使是Qt的静态构建也使用动态链接的MSVC运行时

这将是一个规范问题,提供成功构建满足这些要求的Qt所需的知识。

Qt 5.2 假设环境已准备好XP定位,相关XP定位
qt5xp.patch
和bug修复
qt5fixes.patch
可用-我们必须执行以下操作:

  • 分别从
    qtbase/mkspecs/win32-msvc2012
    qtbase/mkspecs/win32-msvc2012-xp
    复制规范,创建单独的
    win32-msvc2012-static
    win32-msvc2012-static-xp

  • 修改qmake规范

  • 教授配置和qmake makefile有关新的qmake规范

  • 通过在
    qtbase
    中创建一个空的
    .gitignore
    文件,强制引导
    configure.exe

  • 如果您正在使用
    -前缀配置Qt,以便安装目录和生成目录是分开的,那么您必须应用修补程序,至少直到该错误得到修复

  • 下面的批处理文件完成了整个工作。目前,webkit构建对于静态Qt构建是禁用的

    :: Assume that we're in an equivalent of C:\Qt prefix
    @set PREFIX=%~dp0
    :: Qt sources
    @set QT=%PREFIX%..\5.2.1-src
    :: Patch file(s)
    @set SRC=%PREFIX%
    @set SPEC=win32-msvc2012
    @if not exist "%QT%\qt.pro" ( echo Qt source folder expected in %QT%>&2 & exit /b 1 )
    ::
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt5fixes.rej --input=%SRC%\qt5fixes.patch
    ::
    @echo > %QT%\qtbase\.gitignore
    @mkdir %QT%\qtbase\mkspecs\%SPEC%-xp
    @copy %QT%\qtbase\mkspecs\%SPEC%\qplatformdefs.h %QT%\qtbase\mkspecs\%SPEC%-xp
    @copy %QT%\qtbase\mkspecs\%SPEC%\qmake.conf %QT%\qtbase\mkspecs\%SPEC%-xp
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt5xp.rej --input=%SRC%\qt5xp.patch
    ::
    @mkdir %QT%\qtbase\mkspecs\%SPEC%-static
    @copy %QT%\qtbase\mkspecs\%SPEC%\qplatformdefs.h %QT%\qtbase\mkspecs\%SPEC%-static
    @copy %QT%\qtbase\mkspecs\%SPEC%\qmake.conf %QT%\qtbase\mkspecs\%SPEC%-static
    @mkdir %QT%\qtbase\mkspecs\%SPEC%-static-xp
    @copy %QT%\qtbase\mkspecs\%SPEC%-xp\qplatformdefs.h %QT%\qtbase\mkspecs\%SPEC%-static-xp
    @copy %QT%\qtbase\mkspecs\%SPEC%-xp\qmake.conf %QT%\qtbase\mkspecs\%SPEC%-static-xp
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt5static.rej --input=%SRC%\qt5static.patch
    
    撤消对Qt源的更改,请运行以下命令,变量设置如上所述:

    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5static-unfix.rej --input=%SRC%\qt5static.patch
    @del %QT%\qtbase\mkspecs\%SPEC%-static\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-static\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-static
    @del %QT%\qtbase\mkspecs\%SPEC%-static-xp\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-static-xp\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-static-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5xp-unfix.rej --input=%SRC%\qt5xp.patch
    @del %QT%\qtbase\mkspecs\%SPEC%-xp\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-xp\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-xp
    @del %QT%\qtbase\.gitignore
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5fixes-unfix.rej --input=%SRC%\qt5fixes.patch
    
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4static-unfix.rej --input=%SRC%\qt4static.patch
    @del %QT%\mkspecs\%SPEC%-static\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-static\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-static
    @del %QT%\mkspecs\%SPEC%-static-xp\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-static-xp\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-static-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4xp-unfix.rej --input=%SRC%\qt4xp.patch
    @del %QT%\mkspecs\%SPEC%-xp\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-xp\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4fixes-unfix.rej --input=%SRC%\qt4fixes.patch
    
    然后通过执行

    configure -static -platform win32-msvc2012-static-xp (or win32-msvc2012-static)
    jom (or nmake)
    jom install (if doing the build separate from the installation directory)
    
    configure -static -platform win32-msvc2012-static-xp (or win32-msvc2012-static)
    jom (or nmake)
    
    Qt 4.8 假设环境已准备好XP定位,并且相关的XP定位
    qt4xp.patch
    和bug修复
    qt4fixes.patch
    都可用-以下脚本执行此任务:

    :: Assume that we're in an equivalent of C:\Qt prefix
    @set PREFIX=%~dp0
    :: Qt sources
    @set QT=%PREFIX%..\4.8.5-src
    :: Patch file(s)
    @set SRC=%PREFIX%
    @set SPEC=win32-msvc2012
    @if not exist "%QT%\projects.pro" ( echo Qt source folder expected in %QT%>&2 & exit /b 1 )
    ::
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4fixes.rej --input=%SRC%\qt4fixes.patch
    ::
    @mkdir %QT%\mkspecs\%SPEC%-xp
    @copy %QT%\mkspecs\%SPEC%\qplatformdefs.h %QT%\mkspecs\%SPEC%-xp
    @copy %QT%\mkspecs\%SPEC%\qmake.conf %QT%\mkspecs\%SPEC%-xp
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4xp.rej --input=%SRC%\qt4xp.patch
    ::
    @mkdir %QT%\mkspecs\%SPEC%-static
    @copy %QT%\mkspecs\%SPEC%\qplatformdefs.h %QT%\mkspecs\%SPEC%-static
    @copy %QT%\mkspecs\%SPEC%\qmake.conf %QT%\mkspecs\%SPEC%-static
    @mkdir %QT%\mkspecs\%SPEC%-static-xp
    @copy %QT%\mkspecs\%SPEC%-xp\qplatformdefs.h %QT%\mkspecs\%SPEC%-static-xp
    @copy %QT%\mkspecs\%SPEC%-xp\qmake.conf %QT%\mkspecs\%SPEC%-static-xp
    @patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4static.rej --input=%SRC%\qt4static.patch
    
    撤消对Qt源的更改,请运行以下命令,变量设置如上所述:

    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5static-unfix.rej --input=%SRC%\qt5static.patch
    @del %QT%\qtbase\mkspecs\%SPEC%-static\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-static\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-static
    @del %QT%\qtbase\mkspecs\%SPEC%-static-xp\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-static-xp\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-static-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5xp-unfix.rej --input=%SRC%\qt5xp.patch
    @del %QT%\qtbase\mkspecs\%SPEC%-xp\qplatformdefs.h
    @del %QT%\qtbase\mkspecs\%SPEC%-xp\qmake.conf
    @rmdir %QT%\qtbase\mkspecs\%SPEC%-xp
    @del %QT%\qtbase\.gitignore
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5fixes-unfix.rej --input=%SRC%\qt5fixes.patch
    
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4static-unfix.rej --input=%SRC%\qt4static.patch
    @del %QT%\mkspecs\%SPEC%-static\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-static\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-static
    @del %QT%\mkspecs\%SPEC%-static-xp\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-static-xp\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-static-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4xp-unfix.rej --input=%SRC%\qt4xp.patch
    @del %QT%\mkspecs\%SPEC%-xp\qplatformdefs.h
    @del %QT%\mkspecs\%SPEC%-xp\qmake.conf
    @rmdir %QT%\mkspecs\%SPEC%-xp
    ::
    @patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4fixes-unfix.rej --input=%SRC%\qt4fixes.patch
    
    然后通过执行

    configure -static -platform win32-msvc2012-static-xp (or win32-msvc2012-static)
    jom (or nmake)
    jom install (if doing the build separate from the installation directory)
    
    configure -static -platform win32-msvc2012-static-xp (or win32-msvc2012-static)
    jom (or nmake)
    

    嗨,看起来有点奇怪,你把我的问题作为重复题结束了,而事实上我的问题比你的问题早了三年。如果有什么你应该结束你的问题。@this.lau_uu这不是谁第一个的问题:)你写下你自己的(重复的)问题,你写下你自己的答案,然后你去结束你之前的问题。这里有点利益冲突,不是吗?