Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Application bundle - Question about Framework
Forum Update on Monday, May 27th 2025

Qt Application bundle - Question about Framework

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.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.
  • S Offline
    S Offline
    sandy_ind
    wrote on 25 May 2016, 11:39 last edited by A Former User
    #1

    Hi

    I'm building Qt application on OS X and creating an app bundle. I was referring the link http://doc.qt.io/qt-5/osx-deployment.html and found it very useful.

    My only question is :

    In the example given on that link, the whole framework directory is being copied to the bundle.

    cp -R /path/to/Qt/lib/QtCore.framework
    plugandpaint.app/Contents/Frameworks

    My application depends on about 10 Frameworks like QtCore, QtGui, QtWebkit, etc.. and found that the app bundle size is huge (around 400MB). I was wondering if it is really needed to copy the complete framework directory (that contains Headers, and other extra directories) ? or just copying the dependent lib would be sufficient?

    **cp /path/to/Qt/lib/QtGui.framework/Versions/4.0/QtGui plugandpaint.app/Contents/Frameworks/Versions/4.0/QtGui **

    I found my application to be working even if I don't bundle the whole framework. But, just wanted to confirm as I may have not tested the features of the app that may require those extra files.

    Please do help. Thanks!
    Sandy

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on 25 May 2016, 12:04 last edited by
      #2

      You only need the items (library and frameworks) that the application actually uses. An app that is 400 mb sounds like everything was included even if not used (as you suggested).

      Qt has a utility called 'macdeployqt' which does a good job of identifying what the application actually uses and putting all this in the app bundle. You didn't mention this utility so I am just putting this out there in case you didn't see it. You can build the app bundle manually if necessary (using otool etc.) but it isn't necessary.

      For the frameworks you can't just include the library. A framework will contain headers and other 'required' items as well.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sandy_ind
        wrote on 25 May 2016, 13:00 last edited by sandy_ind
        #3

        Thank you so much. I wasn't aware of that utility at all. After running that utility on the app, it copies the required frameworks. but it does not change the rpaths of the executable.

        ex: the otool -L still shows the default rpaths:
        @rpath/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.5.0, current version 5.5.1)

        shouldn't they be changed to @executable_path/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets

        have I missed anything?

        Thanks again!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rondog
          wrote on 26 May 2016, 02:19 last edited by
          #4

          Yes, they should be changed as you suggested.

          I had a look at an app I created and ran 'macdeployqt' on by running 'otool -l' on the executable. A small section of the rather long output looks like this:

          ...
          Load command 14
                    cmd LC_LOAD_DYLIB
                cmdsize 88
                   name @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (offset 24)
             time stamp 2 Wed Dec 31 19:00:02 1969
                current version 5.4.0
          compatibility version 5.4.0
          ...
          

          I have recently updated to Qt 5.6.0 but I haven't built anything yet (I suspect I have to modify 'macdeployqt' which I haven't done yet). From what I gather it only runs the various utilities provided by the OS anyway (such as otool and hdiutil) so it should do the same thing regardless of the version of Qt.

          I guess the short version is that you are right, the rpath should be relative to the executable for anything included in the bundle.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 26 May 2016, 22:14 last edited by SGaist
            #5

            Hi,

            AFAIK, no they don't (well, it depends on your Qt version). The rpath handling has been reworked recently so that you don't need to use @executable_path anymore.

            You can check the Qt Creator bundled provided with the SDK.

            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

            1/5

            25 May 2016, 11:39

            • Login

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