Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Mac] Load shared libraries from bundle
QtWS25 Last Chance

[Mac] Load shared libraries from bundle

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 2 Posters 4.6k Views
  • 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.
  • N Offline
    N Offline
    nowrep
    wrote on last edited by
    #1

    Hi,
    in my app, I use and link to my private library (dylib on Mac).
    Now I want to put this library into bundle and load it from there.
    App is in app.app/Contents/MacOS/app_name and libary in app.app/Contents/MacOS/library.dylib .

    I tried to add RPATH to @executable_path with no success (app cannot be run because of missing library)
    So is there a way (in qmake) to achieve loading shared libraries from bundle?

    Thanks for any answer.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You need to use install_name_tool to change the location of the library in you executable. Have a look at the "OS X deployment guide":http://qt-project.org/doc/qt-4.8/deployment-mac.html for how to use that tool.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nowrep
        wrote on last edited by
        #3

        Hi,
        thanks for your post.
        I finally managed to change the location of my library and now it loads fine.
        I also used macdeployqt on my bundle. Before macdeployqt, Qt libraries were loaded from my Qt install dir and my app worked allright.
        But after macdeployqt, I get this crash on startup:

        @Crashed Thread: 0 Dispatch queue: com.apple.main-thread

        Exception Type: EXC_CRASH (SIGABRT)
        Exception Codes: 0x0000000000000000, 0x0000000000000000

        Application Specific Information:
        objc[3696]: garbage collection is OFF
        abort() called

        Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
        0 libsystem_kernel.dylib 0x00007fff96d1ece2 __pthread_kill + 10
        1 libsystem_c.dylib 0x00007fff97d057d2 pthread_kill + 95
        2 libsystem_c.dylib 0x00007fff97cf6a7a abort + 143
        3 QtCore 0x00000001037b1c15 qt_message_output(QtMsgType, char const*) + 117
        4 QtCore 0x00000001037b1df7 qt_message_output(QtMsgType, char const*) + 599
        5 QtCore 0x00000001037b1fba qFatal(char const*, ...) + 170
        6 QtGui 0x0000000102b09945 QWidgetPrivate::QWidgetPrivate(int) + 853
        7 QtGui 0x0000000102b1dc7b QWidget::QWidget(QWidget*, QFlagsQt::WindowType) + 59
        8 QtGui 0x0000000102a78a19 QDesktopWidget::QDesktopWidget() + 41
        9 QtGui 0x0000000102ac008b QApplication::desktop() + 59
        10 QtGui 0x0000000102a73dbb QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() + 4027
        11 QtGui 0x0000000102a6f4f5 QMacInputContext::reset() + 34853@

        Do you have any idea what's wrong?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Hm, strange. From the output one cannot see what's going wrong exactly. You could try to run the application from the command line and look at the console output:

          /complete/path/to/your/program.app/Contents/MacOS/app_name

          Do you get any warnings about libraries being loaded twice or so?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nowrep
            wrote on last edited by
            #5

            @$ /Users/paulfxh/QupZilla/bin/QupZilla.app/Contents/MacOS/QupZilla
            QupZilla: 0 extensions loaded
            QFont::setPixelSize: Pixel size <= 0 (0)
            QFont::setPixelSize: Pixel size <= 0 (0)
            2012-04-05 22:44:05.484 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/ebldetect.bundle/Contents/MacOS/ebldetect: dlopen(/Library/Internet Plug-Ins/ebldetect.bundle/Contents/MacOS/ebldetect, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/ebldetect.bundle/Contents/MacOS/ebldetect: no matching architecture in universal wrapper
            2012-04-05 22:44:05.492 QupZilla[1404:c03] Cannot find executable for CFBundle 0x10b36e600 </Users/paulfxh/Library/Internet Plug-Ins/GlimsAddition.notplugin> (not loaded)
            2012-04-05 22:44:05.613 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin: dlopen(/Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin: mach-o, but wrong architecture
            2012-04-05 22:44:05.727 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore: dlopen(/Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore: mach-o, but wrong architecture
            2012-04-05 22:44:05.760 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/Flip4Mac WMV Plugin.plugin/Contents/MacOS/Flip4Mac WMV Plugin: dlopen(/Library/Internet Plug-Ins/Flip4Mac WMV Plugin.plugin/Contents/MacOS/Flip4Mac WMV Plugin, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/Flip4Mac WMV Plugin.plugin/Contents/MacOS/Flip4Mac WMV Plugin: no matching architecture in universal wrapper
            2012-04-05 22:44:05.851 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin: dlopen(/Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin, 265): no suitable image found. Did find:
            /Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin: mach-o, but wrong architecture
            2012-04-05 22:44:05.853 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/googletalkbrowserplugin.plugin/Contents/MacOS/googletalkbrowserplugin: dlopen(/Library/Internet Plug-Ins/googletalkbrowserplugin.plugin/Contents/MacOS/googletalkbrowserplugin, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/googletalkbrowserplugin.plugin/Contents/MacOS/googletalkbrowserplugin: mach-o, but wrong architecture
            2012-04-05 22:44:06.164 QupZilla[1404:c03] Error loading /Library/Internet Plug-Ins/iPhotoPhotocast.plugin/Contents/MacOS/iPhotoPhotocast: dlopen(/Library/Internet Plug-Ins/iPhotoPhotocast.plugin/Contents/MacOS/iPhotoPhotocast, 262): no suitable image found. Did find:
            /Library/Internet Plug-Ins/iPhotoPhotocast.plugin/Contents/MacOS/iPhotoPhotocast: no matching architecture in universal wrapper
            @

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Hm, strange. I don't have a clue what's going wrong here, sorry.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved