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. OS X deployment problem (@rpath framework)
Forum Updated to NodeBB v4.3 + New Features

OS X deployment problem (@rpath framework)

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 3 Posters 4.0k Views 2 Watching
  • 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.
  • T Offline
    T Offline
    tsouni
    wrote on 20 Dec 2016, 07:08 last edited by
    #1

    Hi,

    I'm trying to make OS X deployment of my desktop app. I have tried almost everything that I have found from google but none of the fixes seems to work. I'm using the os x deployment tool for sure.

    The error what user gets when trying to start the app is:

    "dyld: Library not loaded: @rpath/QtOpenGL.framework/Versions/5/QtOpenGL

    Referenced from: /Volumes/:Users:jouni:koodaus:qt:gel build:gel/gel.app/Contents/MacOS/gel

    Reason: image not found"

    The .framework file is in the app bundle at Frameworks-directory (placed by the deployment tool). I can run the app from creator but if I try to run it directly (on my development machine) I get the same error.

    Any ideas what should I try?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Dec 2016, 22:57 last edited by
      #2

      Hi and welcome to devnet,

      What version of Qt are you using ?

      Can you also post your .pro file content ?

      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
      0
      • X Offline
        X Offline
        xtingray
        wrote on 8 Feb 2017, 01:06 last edited by xtingray 2 Aug 2017, 02:33
        #3

        I have exactly the same problem. This is my story:

        Until Qt 5.3 I could compile and deploy my Qt app in Mac systems without any issue. My app had a set of plugins and a set of static libraries and the .dmg installer worked pretty well.

        Now, since Qt 5.3 I started to get this compilation error from every one of my static libraries, specifically in OSX:

        rm -f libtupiscenes.a
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -s libtupiscenes.a
        error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: cant open file: libtupiscenes.a (No such file or directory)
        make[3]: *** [libtupiscenes.a] Error 1
        

        So, I had to change my .pro files for the static libraries to become dynamic:
        From this:

           CONFIG += staticlib warn_on
        

        To this:

            CONFIG += dll warn_on
        

        With this change, the compilation process was clean once again, even with Qt 5.8. Now, the deployment process is another story.

        Here is my original deployment script:
        https://github.com/xtingray/tupi/blob/master/tools/build_mac_osx_app.sh

        Pay attention to the line 49 :

        declare -a LIBS=('libtupigui.dylib' 'libtupistore.dylib' 'libtupi.dylib' \
        'libtupibase.dylib' 'libtupinet.dylib' 'libtupifwgui.dylib' 'libtupifwcore.dylib'); 
        

        Now, that I have additional dynamic libraries after the compilation, I had to edit my script like this to add the new dylib files:

        declare -a LIBS=('libtupigui.dylib' 'libtupistore.dylib' 'libtupi.dylib' \
        'libtupibase.dylib' 'libtupinet.dylib' 'libtupifwgui.dylib' 'libtupifwcore.dylib' 'libtupicolorpalette.1.dylib' 'libtupipaintarea.1.dylib' \
        'libtupianimation.1.dylib' 'libtupipen.1.dylib' 'libtupihelp.1.dylib' 'libtupimport.1.dylib' 'libtupiexport.1.dylib' 'libtupiexposure.1.dylib' \
        'libtupitimeline.1.dylib' 'libtupilibrary.1.dylib' 'libtupiscenes.1.dylib' 'libtupitwitter.1.dylib' 'libtupiplugincommon.1.dylib');
        

        Supposedly, the deployment process finishes successfully but when I try either to run the .dmg installer or to run the binary from the terminal I got the same error message mentioned in this thread:

        dyld: Library not loaded: @rpath/QtOpenGL.framework/Versions/5/QtOpenGL
        Referenced from: /Volumes/:Users:me:qt:Tupi build:Tupi/Tupi.app/Contents/MacOS/Tupi
        Reason: image not found
        

        Now, this is the funny thing: If I set the variable DYLD_FRAMEWORK_PATH like this:

        export DYLD_FRAMEWORK_PATH=/Users/me/Qt5.8.0/5.8/clang_64/lib
        

        Then I can run the app from console, typing:

        ./Tupi.app/Contents/MacOS/Tupi
        

        So, my question is: what I have to do or change to get my .dmg installer working as I did before with Qt 5.1?

        Thanks!

        P.S.: Looking inside of the .dmg package I built, I can see all the Qt libraries required by my app, including the QtOpenGL. So why the installer can't find them?

        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/QtOpenGL
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Resources
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions/5
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions/5/Resources
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions/5/Resources/Info.plist
        ./Tupi.app/Contents/Frameworks/QtOpenGL.framework/Versions/Current
        

        Qt Developer

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 8 Feb 2017, 21:21 last edited by
          #4

          Qt Creator's rpath.pri shows a nice way to handle that.

          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
          0
          • X Offline
            X Offline
            xtingray
            wrote on 8 Feb 2017, 23:02 last edited by xtingray 2 Sept 2017, 01:02
            #5

            Thank you! Finally it worked for me, nevertheless I had to include the "Frameworks" path too:

            QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../,-rpath,@executable_path/../Frameworks
            

            I didn't have to do this before Qt 5.1.x versions, but it feels great to know how to fix it for newer versions. Thanks for the hint! :)


            Qt Developer

            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