Qt项目发布ubuntu -加载共享库时出错:libQt5Widgets.so.5

时间:2022-12-15 15:31:25

I want to release my project written with Qt to a Ubuntu / Linux user. If they try to execute the build release version they get this error message, because they have not installed Qt:

我想把用Qt编写的项目发布给Ubuntu / Linux用户。如果他们试图执行构建版本,他们会得到这个错误消息,因为他们没有安装Qt:

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

加载共享库时出错:libQt5Widgets.so。5:无法打开共享对象文件:没有这样的文件或目录

Is there a way to add all the libraries such as libQt5Widgets.so.5 to the folder where the executable is, just like under Windows with qt.conf, where you can specify the Plugins folder?

是否有办法添加所有的库,比如libQt5Widgets.so。5到可执行文件所在的文件夹,就像Windows下的qt.conf一样,您可以在其中指定插件文件夹?

4 个解决方案

#1


-1  

It may be simplest to package the project using Ubuntu's package management system. The Qt dependency will then be automatically installed by the package manager when your project is installed. That'd be the best way to go about it, as long as there is a version of Qt 5 available in Ubuntu's package repository. It'll save you a whole lot of grief.

使用Ubuntu的包管理系统来打包项目可能是最简单的。然后,包管理器将在安装项目时自动安装Qt依赖项。这是最好的方法,只要在Ubuntu的包存储库中有Qt 5的版本。它会帮你省去很多悲伤。

#2


3  

One solution could be:

一个解决方案可以:

export LD_LIBRARY_PATH=/path/to/dir/with/libs:$LD_LIBRARY_PATH

But a proper solution would be to install QT libraries in system and/or package your app for Ubuntu (in your case).

但是一个合适的解决方案是在系统中安装QT库,或者为Ubuntu打包你的应用(在你的例子中)。

#3


3  

Try this

试试这个

sudo apt-get install libqt5widgets5

sudo apt-get安装libqt5widgets5

#4


1  

I had recently updated the Android tools via the SDK manager when I saw this error.

当我看到这个错误时,我最近通过SDK管理器更新了Android工具。

Re-install the SDK tools to fix. That is what worked for my machine.

重新安装要修复的SDK工具。这就是我的机器的工作原理。

#1


-1  

It may be simplest to package the project using Ubuntu's package management system. The Qt dependency will then be automatically installed by the package manager when your project is installed. That'd be the best way to go about it, as long as there is a version of Qt 5 available in Ubuntu's package repository. It'll save you a whole lot of grief.

使用Ubuntu的包管理系统来打包项目可能是最简单的。然后,包管理器将在安装项目时自动安装Qt依赖项。这是最好的方法,只要在Ubuntu的包存储库中有Qt 5的版本。它会帮你省去很多悲伤。

#2


3  

One solution could be:

一个解决方案可以:

export LD_LIBRARY_PATH=/path/to/dir/with/libs:$LD_LIBRARY_PATH

But a proper solution would be to install QT libraries in system and/or package your app for Ubuntu (in your case).

但是一个合适的解决方案是在系统中安装QT库,或者为Ubuntu打包你的应用(在你的例子中)。

#3


3  

Try this

试试这个

sudo apt-get install libqt5widgets5

sudo apt-get安装libqt5widgets5

#4


1  

I had recently updated the Android tools via the SDK manager when I saw this error.

当我看到这个错误时,我最近通过SDK管理器更新了Android工具。

Re-install the SDK tools to fix. That is what worked for my machine.

重新安装要修复的SDK工具。这就是我的机器的工作原理。