在win7 32位上部署Qt应用程序 - Win7 x64上的工作(和编译)

在win7 32位上部署Qt应用程序 -  Win7 x64上的工作(和编译)

问题描述:

嗯,我花了一天时间寻找解决方案,并阅读了所有内容,但是我无法部署我的Qt应用程序,所以我决定问。

Well, I've spent a day looking for solution and have read everything but I am not able to deploy my Qt application, so I decided to ask.

我通过VS 2013 Ultimate中的Visual Studio加载项使用Qt 5.2.1,qt版本是msvcr2012。我有x86版本的Qt 5.2(现在是Qt下载页面底部的第3位)。

I'm using Qt 5.2.1 via the Visual Studio Add-In in VS 2013 Ultimate, the qt version is msvcr2012. I have the x86 version of Qt 5.2 (now the 3rd from the bottom at Qt Downloads page).

我瞄准Win7 32位。

I'm targeting Win7 32-bit.

我的操作系统是Windows 7 64位,我正在为 win32 发布 / o2(最大速度)最优化 / MD(动态C运行时)

My OS is Windows7 64-bit, I'm building the app for win32, release /o2 (max speed) optimalization, /MD (dynamic C runtime), with libraries linked:

qtmain.lib
Qt5Core.lib
Qt5Gui.lib
Qt5Widgets.lib
Qt5PlatformSupport.lib //this one is added by me, the others are automatically set with the Qt-AddIn template.

我构建它,并发布到我发布的文件夹,我把以下内容:

I build it, and to the release folder I put the followings:

编辑:由于我的编译器的版本,我还会分发vs2012 dll.s,如您所见。

because of the version of my compiler, I also distribute the vs2012 dll.s as you see.

.../release                                            /plugins        /platforms

我已经设置了附加的库路径(仅为100%的机会找到它们):

I've set the addittional library path with (just for the 100% chance of finding them):

void registerPluginsDir(QDir& exeDir)
{
QString pluginsRelPath = "plugins";
QString platformsRelPath = "platforms";
QString pluginsPath = exeDir.absoluteFilePath(pluginsRelPath);
QString platformsPath = QDir(pluginsPath).absoluteFilePath(platformsRelPath);
QStringList pathes = QCoreApplication::libraryPaths();
pathes << pluginsPath;
pathes << platformsPath;
QCoreApplication::setLibraryPaths(pathes);

for (auto i : pathes)
    qDebug() << i << "\n";
};

int main(int argc, char *argv[])
{
    QString exePath = QString::fromUtf8(argv[0]);
    QFileInfo exeInfo(exePath);
    QDir exeDir(exeInfo.absolutePath());
    registerPluginsDir(exeDir);

    QApplication a(argc, argv);
    KeyGenerator w;
    w.show();
    return a.exec();
};

裸露是正确的。使用调试器,我看到他们从我的应用程序文件夹加载,而不是从Qt主文件夹加载。

The pathes are correct. With the debugger I saw they were loaded from my app folder, not from the Qt main folder.

使用depends.exe我检查了一切。我只收到2个警告,没有错误:

With depends.exe I checked everything. I only get 2 warnings, no errors:

Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

我在调试应用程序时根据加载的.dll文件复制了.dll-s在Visual Studio中。在系统中,系统dll中的depend.exe和调试器的唯一区别是从SysWOW64加载,而不是system32。

I've copied the .dll-s according to the .dll-s loaded when debugged the app in Visual Studio. The only difference between depends.exe and the debug, that in VS system dll-s were loaded from SysWOW64, not system32.

所有这些都在我的(开发人员)pc上它运行withouth任何错误,但在测试(Win7 32位运行在Microsoft虚拟PC)pc我得到臭名昭着的错误:

With all these on my (developer) pc it runs withouth any error, but on the test (Win7 32-bit running on Microsoft Virtual PC) pc I get the 'infamous' error:

Failed to load platform plugin "windows". Available platforms are:
(and here there are the full pathes to the .dll-s, 
eg: D:\cproj\keygen\win32\Release\plugins\platforms\qwindows.dll, so it must have found them.

我也遵循: http://qt-project.org/wiki/Deploy_an_Application_on_Windows

更名为Qt -dir,控制台只将库文件夹输出(不像我的第一个测试那样的Qt文件夹),它从应用程序文件夹中加载了dll,但是在我的虚拟PC上,或者是我兄弟的pac(Win7 32bit)它给我的错误。关于这个的图片:

I followed this too: http://qt-project.org/wiki/Deploy_an_Application_on_Windows.
Renamed the Qt-dir, the console only output the release folder as library inputs (not the Qt-folders like my first test). It loaded the dll-s from the app folders, launched well. However, on my virtual PC, or on my brother's pac (Win7 32bit) it gives me the error.ˇA picture about this:

如何在32位机器上运行?我用每个build,release-win32,debug-win32 ,没有一个工作,我不能在更多的机器上测试X P它甚至不能加载C运行时,但这不是目标平台。

How to run it on 32-bit machine? I tried it with every build, release-win32, debug-win32, none of them works. I can't test it on more machines, on XP it can't even load the C-runtime, but that's not a target platform.

有关更多信息,请发表评论。

For more info please comment.

编辑:目标pc上的依赖性walker显示与dev pc相同。它仍然找到插件,但无法加载。

Dependency walker on target pc shows the same as on dev pc. It still finds the plugins, but can't load.

问题不在于插件,而且还请求VS2010重新启动。

在我尝试过我在Qt文件夹中找到的所有内容后,尝试运行我的应用程序安装它。现在它也运行在虚拟电脑上,但是,它并没有列出(或我监督这个)依赖。它只列出了2012和2013版本。

The problem was not with the plug-ins, but it also requested the VS2010 redists.
After I tried everything I've found it in the Qt folder, and tried running my app with installing it. Now it runs on the Virtual PC too, however, it was not listed (or I oversaw this) in the dependencies. It only listed 2012 and 2013 versions.