简体   繁体   English

QBS…/ install-root / MyProject:加载共享库时出错:foobar.so:无法打开共享对象文件:没有这样的文件或目录

[英]QBS …/install-root/MyProject: error while loading shared libraries: foobar.so: cannot open shared object file: No such file or directory

Question is for solving this issue in qbs: 问题是为了在qbs中解决此问题:

Here is a file generated by QtCreator. 这是QtCreator生成的文件。 I added in 我加入了

cpp.dynamicLibraries:[
   "/usr/lib/qconsoledesigner/libqconsoletoolkit.so"
]

in

CppApplication {
    Depends { name: "Qt.core" }
    Depends { name: "Qt.network" }

    cpp.cxxLanguageVersion: "c++11"

    cpp.defines: [
        "QT_DEPRECATED_WARNINGS",
    ]
    cpp.dynamicLibraries:[
    "/usr/lib/qconsoledesigner/libqconsoletoolkit.so"
    ]

    consoleApplication: true
    files: "main.cpp"

    Group {     // Properties for the produced executable
        fileTagsFilter: "application"
        qbs.install: true
    }
}

Here is the main(); 这是main();

#include <QCoreApplication>
#include "qconsoledesigner/qconsoletoolkit.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QConsoleToolkit ct;

    return a.exec();
}

Everything builds fine. 一切都很好。 Running produces this error: 运行产生此错误:

/home/.../qtc_Desktop_Qt_5_10_1_GCC_64bit_qt_qt5_Debug/install-root/MyProject: 
error while loading shared libraries: 
libqconsoletoolkit.so: 
cannot open shared object file: 
No such file or directory

Before I physically copy that .so into my install root, I know there must be a QBS property that I can set. 在将那个.so物理复制到安装根目录之前,我知道必须有一个可以设置的QBS属性。

I have tried playing around with the various path related properties in https://doc.qt.io/qbs/qml-qbsmodules-cpp.html , but I am very much groping in the dark. 我尝试在https://doc.qt.io/qbs/qml-qbsmodules-cpp.html中尝试各种与路径相关的属性,但是我在黑暗中摸索着很多。

Thanks. 谢谢。

You can use rpath: https://doc.qt.io/qbs/qml-qbsmodules-cpp.html#rpaths-prop 您可以使用rpath: https : //doc.qt.io/qbs/qml-qbsmodules-cpp.html#rpaths-prop

For "local" use or if you can expect the library to be present wherever your app is installed, simply use the directory where the library is located in at build time: 对于“本地”使用,或者如果您希望库在安装应用程序的任何位置都存在,则只需在构建时使用库所在的目录即可:

cpp.rpaths: "/usr/lib/qconsoledesigner"

Otherwise, you will need to install the library along with your application and use a relative rpath. 否则,您将需要与应用程序一起安装该库,并使用相对的rpath。 At the moment, qbs has no convenience functionality for the former, so you'd write something like this: 目前,qbs没有前者的便利功能,因此您需要编写如下内容:

property stringList sharedLibsToDeploy: "/usr/lib/qconsoledesigner/libqconsoletoolkit.so"
cpp.dynamicLibraries: sharedLibsToDeploy
Group {
    files: sharedLibsToDeploy
    qbs.install: true
    cpp.rpaths: cpp.rpathOrigin // if lib and app are installed into the same dir; adapt otherwise
}

暂无
暂无

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

相关问题 加载共享库时出错:libbsoncxx.so._noabi:无法打开共享对象文件:没有这样的文件或目录 - Error while loading shared libraries: libbsoncxx.so._noabi: cannot open shared object file: No such file or directory 加载共享库时出错:libCstd.so.1:无法打开共享库文件:没有这样的文件或目录 - error while loading shared libraries: libCstd.so.1: cannot open shared object file: No such file or directory 加载共享库时出错:libiomp5.so:无法打开共享库文件:没有这样的文件或目录 - error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory 加载共享库时出错:librocksdb.so.6.12:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: librocksdb.so.6.12: cannot open shared object file: No such file or directory 加载共享库时出错:libgmock.so:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libgmock.so: cannot open shared object file: No such file or directory 加载共享库时出错:libgsl.so.0:无法打开共享对象文件:没有这样的文件或目录 - error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory 加载共享库时出现“错误:libSDL2_mixer-2.0.so.0:无法打开共享库文件:没有这样的文件或目录 - Getting "error while loading shared libraries: libSDL2_mixer-2.0.so.0: cannot open shared object file: No such file or directory 加载共享库时出错:libwx_gtk3u_core-3.1.so.3:无法打开共享 object 文件:没有这样的文件或目录 - error while loading shared libraries: libwx_gtk3u_core-3.1.so.3: cannot open shared object file: No such file or directory Mongodb:加载共享库时出错:libboost_thread.so.1.54.0:&gt;无法打开共享库文件:没有这样的文件或目录 - Mongodb : error while loading shared libraries: libboost_thread.so.1.54.0: > cannot open shared object file: No such file or directory ../main:加载共享库时出错:libopencv_highgui.so.4.0:无法打开共享对象文件:没有这样的文件或目录 - ../main: error while loading shared libraries: libopencv_highgui.so.4.0: cannot open shared object file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM