C++ Qt 项目发布 ubuntu - 加载共享库时出错:libQt5Widgets.so.5
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21244105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Qt project release ubuntu - error while loading shared libraries: libQt5Widgets.so.5
提问by Niklas
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
,您可以在其中指定Plugins
文件夹?
采纳答案by Reinstate Monica
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 版本,这将是最好的方法。它会为你省去很多悲伤。
回答by hoi
Try this
尝试这个
sudo apt-get install libqt5widgets5
须藤 apt-get 安装 libqt5widgets5
回答by kikeenrique
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 打包您的应用程序(在您的情况下)。
回答by Matt Kneiser
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 工具进行修复。这对我的机器有用。