简体   繁体   English

Qt 5.0.2应用程序的可移植性问题。 如何制作简约的Qt包?

[英]Trouble with portability of Qt 5.0.2 applications. How to make minimalistic Qt package?

I know that Qt isn't build statically by default and if there are any files with .lib or .a extension, then these files are import libraries only. 我知道Qt默认情况下不是静态构建的,如果有任何带有.lib或.a扩展名的文件,则这些文件仅是导入库。 I want my applications to be small and portable, so except thinking about recompiling Qt statically I also think about how to make package of dynamic libs as small as possible that can be installed on another computer which has nothing to do with Qt, making it fully operative in case of running my Qt applications. 我希望我的应用程序小巧且可移植,所以除了考虑静态重新编译Qt之外,我还考虑如何使动态库软件包尽可能小,以便可以将其安装在与Qt无关的另一台计算机上,从而使其完全正常运行。在运行我的Qt应用程序时有效。 In this case I am about Windows Xp or higher version of Windows yet. 在这种情况下,我将使用Windows Xp或更高版本的Windows。 In case of creating such a package I realized at first that Qt5 installer doesn't add enything to the system and user Path and I was unable to run my compiled apps without Qt Creator. 在创建这样一个程序包的情况下,我首先意识到Qt5安装程序不会向系统和用户Path添加任何内容,并且在没有Qt Creator的情况下我无法运行编译的应用程序。 However after I added to the system and user Path variable this: 但是,在我向系统和用户Path变量添加以下代码之后:

"K:\\Qt\\Qt5.0.2\\5.0.2\\mingw47_32\\bin" “ K:\\ Qt \\ Qt5.0.2 \\ 5.0.2 \\ mingw47_32 \\ bin”

where 哪里

"K:\\Qt\\Qt5.0.2" “ K:\\ Qt \\ Qt5.0.2”

is Qt installation folder, I am able to run my apps outside of Qt Creator from any location on drive. 是Qt安装文件夹,我可以从驱动器上的任何位置在Qt Creator外部运行我的应用程序。 With this fact in mind I thought that as for such a package it is enough to copy 考虑到这一事实,我认为对于这样的程序包来说,足以复制

"K:\\Qt\\Qt5.0.2\\5.0.2\\mingw47_32\\bin" “ K:\\ Qt \\ Qt5.0.2 \\ 5.0.2 \\ mingw47_32 \\ bin”

to another computer, add it to system and user Path and everything will be as I want. 到另一台计算机上,将其添加到系统和用户路径中,一切都会如我所愿。 Unfortunately this is not true. 不幸的是,这不是事实。 While being disappointed a little that I couldn't run my apps on my second PC, I'd installed the same Qt version there, made similar Path entries and everything started to work all right. 令我有些失望的是我无法在第二台PC上运行我的应用程序,我在那里安装了相同的Qt版本,输入了类似的Path条目,并且一切正常。 More specifically, the installation directory on a second PC is: 更具体地说,第二台PC上的安装目录为:

"M:\\Qt\\Qt5.0.2" “ M:\\ Qt \\ Qt5.0.2”

and if I add to the Path this: 如果我添加到路径中,则:

"M:\\Qt\\Qt5.0.2\\5.0.2\\mingw47_32\\bin" “ M:\\ Qt \\ Qt5.0.2 \\ 5.0.2 \\ mingw47_32 \\ bin”

then it works, but if instead of it I add this: 然后它可以工作,但是如果不是我可以添加它:

"M:\\Qt_5.0.2_libs\\bin" “ M:\\ Qt_5.0.2_libs \\ bin”

which contains exactly the same files as "M:\\Qt\\Qt5.0.2\\5.0.2\\mingw47_32\\bin" 其中包含与“ M:\\ Qt \\ Qt5.0.2 \\ 5.0.2 \\ mingw47_32 \\ bin”完全相同的文件

then it does not. 那就没有。

So my question is: 所以我的问题是:

What do I'm missing so it doesn't work and how to make such a minimalistic package ? 我缺少什么,所以它不起作用以及如何制作这样的简约包装?

Qt文档中介绍了部署应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM