I worked with Qt Creator 2.6.2 based on Qt 5.0.1 in a linux environnement. The application works fine on the computer where I made the compilation but when I execute it on another computer I got errors like :

在linux环境中,我以Qt 5.0.1为基础,与Qt Creator 2.6.2一起工作。这个应用程序在我编译的电脑上运行得很好,但是当我在另一台电脑上执行它时,我得到了如下错误:

error while loading shared libraries: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory
error while loading shared libraries: libxslt.so.1: cannot open shared object file: No such file or directory

I found some solutions in this link (some links are dead).

我在这个链接中找到了一些解决方案(有些链接已经失效)。

So I added to my .pro file this line :

所以我在。pro文件中添加了这一行:

CONFIG += static

To compile my project statically.

静态编译我的项目。

I thought the file I'll get will be larger but I got the same size and the same errors.

我想我得到的文件会更大,但是我得到了相同的大小和相同的错误。

Thank you.

谢谢你!

1 个解决方案

#1


9

The Qt shared libraries don't exist on the other computer you tested it on. So you need to either:

Qt共享库并不存在于您测试的另一台计算机上。所以你需要

  1. Copy the shared libraries to your other machine. Or...
  2. 将共享库复制到另一台计算机。还是……
  3. Create a static Qt build to link with your application.
  4. 创建与应用程序链接的静态Qt构建。

It's not sufficient to just add CONFIG += static to your .pro file, you also need Qt static libraries. So to do #2 you'll need to get the Qt source code and build it yourself.

仅仅将CONFIG += static添加到.pro文件是不够的,还需要Qt静态库。要做到第2点,你需要获得Qt源代码并自己构建它。

Also, Qt is licensed under the LGPL so you'll need to be aware of that when static linking. There are some who believe that the LGPL does not allow static linking (unless you LGPL your own code) and others who believe that it does (so long as you're willing to release the object code for your app). But that's a whole other discussion.

而且,Qt是在LGPL下授权的,所以当静态链接时,您需要知道这一点。有人认为LGPL不允许静态链接(除非你自己的代码LGPL),也有人认为LGPL允许静态链接(只要你愿意为你的应用发布对象代码)。但这是另一个话题。

更多相关文章

  1. 求GridControl_11.1.0.1.0_Linux_x86-64_1of3 的下载链接最好是
  2. Linux-自己创建动态库静态库
  3. 用GCC编译链接程序--编译链接器GCC常用功能(菜鸟级)
  4. SUSE LINUX虚拟机设置静态IP
  5. 对于Linux创建链接时终目录和文件处理的认识
  6. Linux下动态链接库创建问题
  7. Sqlserver 链接服务器和同义词
  8. SQL SERVER创建链接服务器
  9. Flask-SQLAlchemy 中多表链接查询(不使用外键)

随机推荐

  1. Php DateTime :: setDate()不在第一个DateP
  2. 使用ajax在服务器端恢复json时出错
  3. 在Cake PHP中更新现有的sql数据
  4. Zend数据库适配器-未捕获异常-堆栈跟踪显
  5. PHP中使用sleep函数实现定时任务实例分享
  6. PHP脚本在我的Wordpress文件中。请解码或
  7. 微信JS-SDK——微信分享给朋友
  8. 一个简易的PHP读取CSV文件的方法
  9. php is_dir 判断是否存在这目录
  10. php使用openssl进行Rsa长数据加密(117)解