Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [SOLVED] Deploying a dylib file on mac

    Installation and Deployment
    2
    5
    1992
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      igorland last edited by

      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 +=
      -L/usr/local/Cellar/boost/1.55.0_2/lib
      -lboost_system@

      Then like this:

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

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        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)

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • I
          igorland last edited by

          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 +=
          -L/usr/local/Cellar/boost/1.55.0_2/lib/libboost_system.a@

          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!

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Indeed, it's what you are doing.

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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • I
              igorland last edited by

              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@

              NOT

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

              It is working great now. Many thanks!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post