[SOLVED] Deploying a dylib file on mac

  • Hello. I have created a mac plugin, which is basically a dylib file. The plugin includes a couple of boost libraries, and no qt libs. Now I am trying to deploy it and, understandably, receive a dependancy error:

    Get the following error in the Log.txt:
    dlerror:dlopen(/Users/igorland/X-Plane 10/Resources/plugins/MyPlugin/mac.xpl, 6): Library not loaded: /usr/local/lib/libboost_system.dylib
    Referenced from: /Users/igorland/X-Plane 10/Resources/plugins/MyPlugin/mac.xpl
    Reason: image not found@

    So, I try to link the boost_system library.

    First like this:
    LIBS +=

    Then like this:

    @LIBS +=

    Then, I select the project file and add an external library through the menu, which adds the following:

    @win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/release/ -lboost_system
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/debug/ -lboost_system
    else:unix: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/ -lboost_system

    INCLUDEPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib
    DEPENDPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/release/libboost_system.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/debug/libboost_system.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/release/boost_system.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/debug/boost_system.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.55.0_2/lib/libboost_system.a@

    In all cases, I still have the same issue with the file.

    When I did my first Qt application on Mac, I had to use the Qt Mac Deployment Tool to link the libraries. However, my understanding is that since it is not an app bundle but a dll, sorry dylib, I cannot do it. What is the proper way to link statically libraries in a dylib (this and a couple of others like libc++.)

    Thanks a lot in advance.

  • Lifetime Qt Champion


    You have to link to the corresponding a files, or depending on your needs you could also to the framework way (it doesn't look like an option but I may be wrong)

  • Thank you, SGaist!
    [quote author="SGaist" date="1409786537"]Hi,

    You have to link to the corresponding a files, ...[/quote]

    Sorry, SGaist, but isn't it what I am doing by:

    @LIBS +=

    Although, in this case, the error is a bit different:

    @dlerror:dlopen(/Users/igorland/X-Plane 10/Resources/plugins/iGoDispatchConnect/mac.xpl, 6): Symbol not found: __ZN5boost6system15system_categoryEv
    Referenced from: /Users/igorland/X-Plane 10/Resources/plugins/iGoDispatchConnect/mac.xpl
    Expected in: flat namespace
    in /Users/igorland/X-Plane 10/Resources/plugins/iGoDispatchConnect/mac.xpl@

    Thank you so much for always being supportive!

  • Lifetime Qt Champion

    Indeed, it's what you are doing.

    Can you show what otool -L returns when run on you dylib file ?

  • SGaist, thanks for your support.

    Re-read multiple threads and tutorials again. Argh! Little things...

    @LIBS += /usr/local/Cellar/boost/1.55.0_2/lib/libboost_system.a@


    @LIBS +=

    It is working great now. Many thanks!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.