我需要静态编译Qt。我必须在运行Windows XP的虚拟机上执行此操作。由于此要求,我无法使用Wiki页面How to build a static Qt for Windows/MinGW中建议的PowerShell 3.0脚本(无法在WinXP上安装PowerShell 3.0)。
我尝试阅读脚本并手动逐步完成其工作。
我添加到C:\Qt\5.3\Src\qtbase\mkspecs\win32-g++\qmake.conf
文件的末尾:
# [QT-STATIC-PATCH]
QMAKE_LFLAGS += -static -static-libgcc
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
DEFINES += QT_STATIC_BUILD
我运行了配置:
mkdir C:\Qt\5.3\Static-build
cd C:\Qt\5.3\Static-build
..\Src\configure.bat -static -debug-and-release -platform win32-g++ \
-prefix C:\Qt\5.3\Static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg \
-qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl -opensource \
-confirm-license -make libs -nomake tools -nomake examples -nomake tests
这似乎没问题:
This is the Qt for Windows Open Source Edition.
You have already accepted the terms of the license.
Creating qmake...
mingw32-make: Nothing to be done for 'first'.
Running configuration tests...
Environment:
INCLUDE=
Unset
LIB=
Unset
PATH=
C:\Qt\5.3\mingw482_32\bin
C:\Qt\Tools\mingw482_32\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\Program Files\Git\git-cheetah\..\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\Git\cmd
C:\Program Files\TortoiseGit\bin
C:\Program Files\CMake\bin
C:\Python27
C:\StrawberryPerl\perl\bin
C:\StrawberryPerl\win32
C:\WINDOWS\system32\WindowsPowerShell\v1.0
Configuration:
pcre
debug
compile_examples
Qt Configuration:
minimal-config
small-config
medium-config
large-config
full-config
debug_and_release build_all release
debug
c++11
static
zlib
gif
jpeg
png
freetype
build_all
accessibility
opengl
audio-backend
native-gestures
qpa
iconv
concurrent
QMAKESPEC...................win32-g++ (commandline)
Architecture................i386, features:
Host Architecture...........i386, features:
Maketool....................mingw32-make
Debug build.................yes (combined)
Default build...............debug
Force debug info............no
C++11 support...............yes
Link Time Code Generation...no
Accessibility support.......yes
RTTI support................yes
SSE2 support................yes
SSE3 support................yes
SSSE3 support...............yes
SSE4.1 support..............yes
SSE4.2 support..............yes
AVX support.................yes
AVX2 support................yes
NEON support................no
IWMMXT support..............no
OpenGL support..............yes
Large File support..........yes
NIS support.................no
Iconv support...............yes
Evdev support...............no
Mtdev support...............no
Inotify support.............no
eventfd(7) support..........no
Glib support................no
CUPS support................no
OpenVG support..............no
OpenSSL support.............no
Qt D-Bus support............no
Qt Widgets module support...yes
Qt GUI module support.......yes
QML debugging...............yes
DirectWrite support.........no
Use system proxies..........no
QPA Backends:
GDI.....................yes
Direct2D................no
Third Party Libraries:
ZLIB support............qt
GIF support.............yes
JPEG support............yes
PNG support.............yes
FreeType support........yes
Fontconfig support......no
HarfBuzz-NG support.....no
PCRE support............qt
ICU support.............no
ANGLE...................no
Dynamic OpenGL..........no
Styles:
Windows.................yes
Windows XP..............yes
Windows Vista...........yes
Fusion..................yes
Windows CE..............no
Windows Mobile..........no
Sql Drivers:
ODBC....................no
MySQL...................no
OCI.....................no
PostgreSQL..............no
TDS.....................no
DB2.....................no
SQLite..................yes (qt)
SQLite2.................no
InterBase...............no
Sources are in..............C:\Qt\5.3\Src\qtbase
Build is done in............C:\Qt\5.3\Static-build\qtbase
Install prefix..............C:\Qt\5.3\Static
Headers installed to........C:\Qt\5.3\Static\include
Libraries installed to......C:\Qt\5.3\Static\lib
Arch-dep. data to...........C:\Qt\5.3\Static
Plugins installed to........C:\Qt\5.3\Static\plugins
Library execs installed to..C:\Qt\5.3\Static\bin
QML1 imports installed to...C:\Qt\5.3\Static\imports
QML2 imports installed to...C:\Qt\5.3\Static\qml
Binaries installed to.......C:\Qt\5.3\Static\bin
Arch-indep. data to.........C:\Qt\5.3\Static
Docs installed to...........C:\Qt\5.3\Static\doc
Translations installed to...C:\Qt\5.3\Static\translations
Examples installed to.......C:\Qt\5.3\Static\examples
Tests installed to..........C:\Qt\5.3\Static\tests
WARNING: Using static linking will disable the use of plugins.
Make sure you compile ALL needed modules into the library.
Generating Makefiles...
Qt is now configured for building. Just run mingw32-make.
To reconfigure, run mingw32-make confclean and configure.
但是mingw32-make的编译在某些时候失败了:
cd qml/ && ( test -e Makefile || c:/Qt/5.3/Static-build/qtbase/bin/qmake.exe C:/Qt/5.3/Src/qtdeclarative/tools/qml/qml.pro -o
Makefile ) && c:/Qt/Tools/mingw482_32/bin/mingw32-make -f Makefile
'QT_PLUGIN_PATH' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
Project ERROR: Failed to parse qmlimportscanner output.
Makefile:94: recipe for target 'sub-qml-make_first' failed
mingw32-make[2]: *** [sub-qml-make_first] Error 3
mingw32-make[2]: Leaving directory 'c:/Qt/5.3/Static-build/qtdeclarative/tools'
Makefile:66: recipe for target 'sub-tools-make_first' failed
mingw32-make[1]: *** [sub-tools-make_first] Error 2
mingw32-make[1]: Leaving directory 'c:/Qt/5.3/Static-build/qtdeclarative'
Makefile:101: recipe for target 'module-qtdeclarative-make_first' failed
mingw32-make: *** [module-qtdeclarative-make_first] Error 2
对不起法语措辞。有趣的是:
'QT_PLUGIN_PATH'无法识别为内部或外部命令,可执行程序或命令文件
我发现其他人有同样的问题(here),并尝试了他们建议的解决方案(来自here):
我添加了
QMAKE_LFLAGS_STATIC_LIB += -static
到qtbase / mkspecs / win32-g ++ / qmake.conf并添加
static:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB
到qtbase / mkspecs / features / default_post.prf
我仍然有错误。
所以我有两个问题:
'QT_PLUGIN_PATH' is not recognized [...]
? 答案 0 :(得分:0)
好的,出于一个奇怪的原因,在关闭我的控制台后,重新打开它并重新尝试,它有效:/我将这个问题保持打开,以防有人对''QT_PLUGIN_PATH'的更好解释无法识别[ ......]“错误。显然我不是第一个陷入这个错误的人。