问题描述
我正在使用windeployqt
可执行文件来准备我的安装树.该工具将所有必需的(甚至是一些不必要的)dll复制到指定的文件夹中,并在Qt5Core.dll上进行修补以获取硬编码的路径变量.以下是我执行该工具的方式.
I'm using windeployqt
executable to do prepare my installation tree. The tool copies all required (and even some unnecessary) dlls into the designated folder, and does patching on Qt5Core.dll for hardcoded path variables. The following is how I execute the tool.
C:\Qt\5.11.2\mingw53_32\bin>windeployqt.exe D:\ImaqD:\Imaq\Imaq.exe 32 bit, debug executableAdding Qt5Svg for qsvgicond.dllDirect dependencies: Qt5Core Qt5Gui Qt5Network Qt5WidgetsAll dependencies : Qt5Core Qt5Gui Qt5Network Qt5WidgetsTo be deployed : Qt5Core Qt5Gui Qt5Network Qt5Svg Qt5WidgetsUpdating Qt5Cored.dll.Updating Qt5Guid.dll.Updating Qt5Networkd.dll.Updating Qt5Svgd.dll.Updating Qt5Widgetsd.dll.Updating libGLESV2d.dll.Updating libEGLd.dll.Updating D3Dcompiler_47.dll.Updating opengl32sw.dll.Updating libgcc_s_dw2-1.dll.Updating libstdc++-6.dll.Patching Qt5Cored.dll...Creating directory D:/Imaq/bearer.Updating qgenericbearerd.dll.Creating directory D:/Imaq/iconengines.Updating qsvgicond.dll.Creating directory D:/Imaq/imageformats.Updating qgifd.dll.Updating qicnsd.dll.Updating qicod.dll.Updating qjpegd.dll.Updating qsvgd.dll.Updating qtgad.dll.Updating qtiffd.dll.Updating qwbmpd.dll.Updating qwebpd.dll.Creating directory D:/Imaq/platforms.Updating qwindowsd.dll.Creating directory D:/Imaq/styles.Updating qwindowsvistastyled.dll.Creating D:\Imaq\translations...Creating qt_ar.qm...Creating qt_bg.qm.....
从上面的输出中,看起来该工具正在运行,没有任何错误.但是在部署之后,如果我尝试执行二进制文件,则会显示以下错误.
C:\Qt\5.11.2\mingw53_32\bin>windeployqt.exe D:\ImaqD:\Imaq\Imaq.exe 32 bit, debug executableAdding Qt5Svg for qsvgicond.dllDirect dependencies: Qt5Core Qt5Gui Qt5Network Qt5WidgetsAll dependencies : Qt5Core Qt5Gui Qt5Network Qt5WidgetsTo be deployed : Qt5Core Qt5Gui Qt5Network Qt5Svg Qt5WidgetsUpdating Qt5Cored.dll.Updating Qt5Guid.dll.Updating Qt5Networkd.dll.Updating Qt5Svgd.dll.Updating Qt5Widgetsd.dll.Updating libGLESV2d.dll.Updating libEGLd.dll.Updating D3Dcompiler_47.dll.Updating opengl32sw.dll.Updating libgcc_s_dw2-1.dll.Updating libstdc++-6.dll.Patching Qt5Cored.dll...Creating directory D:/Imaq/bearer.Updating qgenericbearerd.dll.Creating directory D:/Imaq/iconengines.Updating qsvgicond.dll.Creating directory D:/Imaq/imageformats.Updating qgifd.dll.Updating qicnsd.dll.Updating qicod.dll.Updating qjpegd.dll.Updating qsvgd.dll.Updating qtgad.dll.Updating qtiffd.dll.Updating qwbmpd.dll.Updating qwebpd.dll.Creating directory D:/Imaq/platforms.Updating qwindowsd.dll.Creating directory D:/Imaq/styles.Updating qwindowsvistastyled.dll.Creating D:\Imaq\translations...Creating qt_ar.qm...Creating qt_bg.qm.....
From the above output, it looks like the tool is running without any errors. But after deployment, if I try to execute the binary, the following errors are shown.
从该错误看来,正在复制错误的dll.但是,在我的机器上,我只有一个编译器(mingw53_32),并且这些dll没有其他可能的版本.
From the error, it looks like wrong dlls are being copied. But, on my machine, I have only one compiler (mingw53_32) and there are no other possible versions of those dlls.
注意:我已经使用在线安装程序安装了Qt,并且我仅从列表中选择了Qt Creator和Qt mingw.安装程序中列出的所有其他组件均未选中.我想知道这个问题是否是由于缺少任何组件造成的.
Note: I have installed Qt using the online installer, and I have only chose Qt creator, and Qt mingw from the list. Every other component listed in the installer was unchecked. I'm wondering if this issue is because of any missing components.
我还尝试了--debug,--compiler-runtime之类的开关,尽管这些开关似乎与该问题没有任何关系.任何指针将不胜感激.
Also, I have tried switches like --debug, --compiler-runtime, although those switches doesn't seems to have anything to do with this problem. Any pointers would be much appreciated.
推荐答案
据我从windeployqt
输出了解,您正在尝试部署应用程序的调试版本(因为windeployqt.exe
正在复制`Qt5Cored.dll,Qt5Guid, .dll,Qt5Networkd.dll'等库).您应该尝试部署该应用程序的发行版.
As I understood from your windeployqt
output, you are trying to deploy debug build of your application (as windeployqt.exe
is copying `Qt5Cored.dll, Qt5Guid.dll, Qt5Networkd.dll', etc. libraries). You should try to deploy the release build of the app.
在Qt创建器中,您将在运行按钮上方的左下方找到该选项.在项目打开时,通过单击左侧工具栏中的项目",可以访问Debug和Release版本的构建配置.
In Qt creator, you will find the option towards the left bottom, just above the run button. Build configurations for Debug and Release build can be accessed by clicking on "Projects" in the left toolbar while your project is open.
Qt 5.11.2随windeployqt一起提供了一个选项/标志,用于创建与调试/发布可执行文件相关的依赖项.
Qt 5.11.2 is providing an option/flag along with windeployqt for creating dependencies associated with debug/release executable.
用于创建依赖于调试版本的dll: windeployqt可执行文件--debug
For creation of debug version dependent dlls:windeployqt executable --debug
要创建与发行版相关的dll,请执行以下操作: windeployqt可执行文件--release
For creation of release version dependent dlls:windeployqt executable --release
这篇关于Qt windeployqt导致无法使用的部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!