Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Try to deploy a Subdirs project in Linux.



  • Hello I'm trying to deploy an application in Linux, in Qt Creator I build in release mode and everything looks good. When I attempt to run the application from the terminal or from file manager it won't run. When I run from the terminal I get the message:

    (executable file created in creator) error while loading shared libraries: (dependencies filename) cannot open shared object file: No such file or directory

    when I run an ldd -d on my executable I can see the following:
    lib from core location => not found
    When I attempt to copy this to the same directory there is no effect, and when I attempt to point to the dependencies location I can't seem to change the not found error. Assistance on how to point to the dependencies' location is greatly appreciated.



  • @JoeJoe_000
    To install a Qt application you have written you are supposed to use something like linuxdeployqt. Are you doing so?



  • @JoeJoe_000 said in Try to deploy a Subdirs project in Linux.:

    when I run an ldd -d on my executable I can see the following:
    lib from core location => not found

    Your issue is not related to the subdirs type of project.
    On Linux you need to instruct the linker to write the location of the used libs into the executable like this (supposed you use qmake):

    YOUR_LIB = /usr/local
    
    INCLUDEPATH += \
        $${YOUR_LIB}/include
    
    unix::!mac {
        LIBS += -Wl,-rpath=$${YOUR_LIB}/lib
    }
    

    You need to add these lines to the pro-file of the application, not the pro-file of the root directory.



  • @django-Reinhard said in Try to deploy a Subdirs project in Linux.:

    -rpath=$${YOUR_LIB}/lib

    The OP says he is trying to deploy the application, presumably to another machine. Doesn't the above "bake in" a path on the development machine which may not be correct on the deployment machine?



  • @JonB said in Try to deploy a Subdirs project in Linux.:

    Doesn't the above "bake in" a path on the development machine which may not be correct on the deployment machine?

    Sure!

    May be I didn't understand the TO right. I thought he want to call the executable from a different location (possibly on the same machine).
    I had similar problem on my machine, that the shared libs where not found after copying the app to different location.
    With the "right" path baken in, it works like expected.



  • @django-Reinhard
    Since the OP talks about "deploying" his Linux app, that is why I asked about linuxdeployqt which is the usual tool to accomplish this, guaranteeing that the target system gets the right libraries in the right places on the new system.



  • Then i thank you for the clear explanation.
    Possibly I can even use the tool some day



  • @django-Reinhard
    Fortunately I do not distribute any Qt apps, so I have never used them :) But if I did I would be looking at using linuxdeployqt and windeployqt.


Log in to reply