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

Portable Qt application for Mac



  • Hi everybody.
    I have just compiled an application on my Mac. On my Mac the application works. Now I want to copy ad use it on another mac without QtSDK installed. On Linux I can use this row "LIBS += -Wl,-rpath=\$$ORIGIN/libs" for define the directory of the required qt libs but on Mac does not works.
    How can I do for define the directory of the required qt libs?



  • Try set it up in application http://doc.qt.nokia.com/4.7-snapshot/qcoreapplication.html#addLibraryPath :

    @
    QApplication::addLibraryPath(QString);
    @



  • I have solved with "plugins" but not with "libs".

    For example: Where must I put the library "QtDeclarative"?
    I have add to application
    "QApplication::addLibraryPath("libs");"
    Now where I must create the "libs" directory?
    Which are the files to copy in libs from "qtDeclarative.framework" directory?



  • Use full path (you can use QApplication::applicationDirPath() to return full path to your application):
    @
    QApplication::addLibraryPath(QApplication::applicationDirPath()+"/libs");
    @

    and there you go.



  • Ok and then where I must create the libs directory? Which is the files that I must put in?
    See the error:

    Dyld Error Message:
    Library not loaded: /Users/USER//QtDeclarative.framework/Versions/4/QtDeclarative
    Reference from: /Users/USER/
    /DomusBossTouch.app/Contents/MacOS/DomusBossTouch



  • I think, here:
    /DomusBossTouch.app/Contents/MacOS/DomusBossTouch/libs



  • Solved using macdeployqt in QTDIR/bin/


Log in to reply