我使用 VS2013 构建了一个静态 x86 Qt5.5 库:
配置 -static -prefix D:\Qt\qt-5.5.0-x86-static -opensource -release -static-runtime -nomake examples -no-compile-examples -static-runtime -nomake tools -no-iconv -qt- zlib -skip qtwebkit -confirm-license -qmake -opengl 桌面 -no-angle -nomake 测试 -target xp
之后,我使用这个静态库构建了我的 Qml 应用程序的静态链接 exe。它可以在我安装了Qt5.5的windows中随处运行。
然后我用 VMware Workstation 安装了一个纯 Windows XP SP3 只安装了 VC2008 运行时而不是 VC2013 运行时。
首先,我将exe复制到这个XP中。它可以运行,但没有任何显示。我需要在 taskmgr 中杀死它。
其次,我将所有文件夹复制D:\Qt\qt-5.5.0-x86-static\qml
到我的exe的根目录中,它可以运行。但它只显示了一个带有正确窗口标题的空白窗口。
我想我已经听取了Deploying Qt 5 App on Windows中的所有建议。但是为什么qml部分不能编译成静态库呢?如何让我的应用程序不显示空白?
PS 即使我windeployqt
用来部署应用程序的共享链接库版本。它还向我显示了空白窗口。但它可以在 Windows 7 上运行。
qtdiag 在我的虚拟 XP 上的输出:
Qt 5.5.0 (i386-little_endian-ilp32 static release build; by MSVC 2013) on "window ws" OS: Windows XP [winnt version 5.1.2600]
架构:i386;特点:SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
库信息: PrefixPath: D:\Qt\qt-5.5.0-x86-static
DocumentationPath: D:\Qt\qt-5.5.0-x86-static\doc HeadersPath: D:\Qt\qt-5.5.0- x86-static\include LibrariesPath: D:\Qt\qt-5.5.0-x86-static\lib LibraryExecutablesPath: D:\Qt\qt-5.5.0-x86-static\bin BinariesPath: D:\Qt\qt- 5.5.0-x86-static\bin PluginsPath: D:\Qt\qt-5.5.0-x86-static\plugins ImportsPath: D:\Qt\qt-5.5.0-x86-static\imports Qml2ImportsPath: D:\ Qt\qt-5.5.0-x86-static\qml ArchDataPath: D:\Qt\qt-5.5.0-x86-static DataPath: D:\Qt\qt-5.5.0-x86-static
TranslationsPath: D:\ Qt\qt-5.5.0-x86-static\translations
ExamplesPath: D:\Qt\qt-5.5.0-x86-static\examples TestsPath: D:\Qt\qt-5.5.0-x86-static\tests SettingsPath :标准路径 [ ...表示可写条目]: DesktopLocation: "Desktop" *C:\Documents and Settings\Administrator\
最后的结论:问题是我的虚拟Windows XP中的图形驱动程序。它可以在其他真实PC上运行。
但是 QML 的静态构建存在一个可悲的问题。我发现了这个:
https ://forum.qt.io/topic/22035/qml-apps-not-runnable-using-static-build-up-to-qt-5-0-1-release/24
原因为什么我需要复制这样的文件夹Qt
QtQuick.2
QtQuick
是那些库不能编译加载。即使我将它们添加到 .pro 文件中。从 Qt 5.0 到 Qt 5.5。官方方面似乎不喜欢人们通过静态链接使用 QML。因此,静态构建 QML 应用程序是浪费时间。