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. macdeployqt strips resources from deployed binary
Forum Updated to NodeBB v4.3 + New Features

macdeployqt strips resources from deployed binary

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
13 Posts 6 Posters 4.6k Views 1 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.
  • D Offline
    D Offline
    DJ-Ogurt
    wrote on last edited by DJ-Ogurt
    #1

    Hey all,

    I'm working on a project which needs to deploy to the macos and while everything compiles fine (through out cmake build system) and the binary runs fine on my development machine; when I run the macdeployqt binary on the app bundle the resources seem to get stripped out. I've played with all the options on macdeployqt, but nothing changes this behavior. Does anyone have any advice? The binary works otherwise, but all of our branding images are gone.

    J.HilkJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt ?
      What version of Xcode ?
      What version of macOS ?
      Can you provide a minimal compilable example that shows that behaviour ?

      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
      • D Offline
        D Offline
        DJ-Ogurt
        wrote on last edited by
        #3

        Qt 5.10
        Using clang directly via cmake which has version string clang-900.0.39.2
        Macos 10.13.3

        Not sure if I can provide a a minimal example, as the images do get compiled into the binary and work fine. Only the deploy step messes up.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's the goal: build the same application as you and try to trigger the bug with macdeployqt.

          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
          • D DJ-Ogurt

            Hey all,

            I'm working on a project which needs to deploy to the macos and while everything compiles fine (through out cmake build system) and the binary runs fine on my development machine; when I run the macdeployqt binary on the app bundle the resources seem to get stripped out. I've played with all the options on macdeployqt, but nothing changes this behavior. Does anyone have any advice? The binary works otherwise, but all of our branding images are gone.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @DJ-Ogurt just to make sure, you actually modified your *.pro file to add extra sources to the app-bundle, using QMAKE_BUNDLE_DATA? As far as I know macdeployqt does not copy automatically non Qt-Related (ressource files, frameworks etc) files to make the bundle Executable. The Windows tool doesn't either.

            wiki link
            docs link


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2
            • D Offline
              D Offline
              DJ-Ogurt
              wrote on last edited by
              #6

              @J-Hilk I'm not using a *.pro file. I suppose that could be the issue if the deploy program looks for that. Should the project file be in the same directory as the binary or as the app bundle?

              J.HilkJ 1 Reply Last reply
              0
              • D DJ-Ogurt

                @J-Hilk I'm not using a *.pro file. I suppose that could be the issue if the deploy program looks for that. Should the project file be in the same directory as the binary or as the app bundle?

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @DJ-Ogurt you missunderstood me.

                The macdeployqt-tool does not need a .pro file. It will go through your qt installation and fetch all (most of the time) dependencies of application and copy them to the appropriate location inside your .app file.
                Somtimes you'll have to specify a path, for example if you use qml you'll have to tell the tool where to look for those, or other options.

                If your application needs additional files that are not part of the binary - for example pixtures in your case, you will have to

                • a: copy those by hand to the correct place
                  or
                • b: use the QMAKE_BUNDLE_DATA inside your Qt-Project file to tell qmake(I believe) to copy the needed files to the correct place, when creating the binary

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                1
                • D Offline
                  D Offline
                  DJ-Ogurt
                  wrote on last edited by
                  #8

                  Ok. So I don't believe I'm using any qml. I do have a qrc file which is included with my cmakelists.txt with

                  QT5_ADD_RESOURCES(RES_SOURCES
                    resources/resources.qrc
                    )
                  

                  Images are used in the ui_headers with lines like

                  <string notr="true">background-image: url(:/images/background.svg)
                  

                  the folder images is a sub directory in resources.

                  I'm fine with coping by hand, but I'm not sure where in the app bundle the images should end up.

                  J.HilkJ 1 Reply Last reply
                  0
                  • D DJ-Ogurt

                    Ok. So I don't believe I'm using any qml. I do have a qrc file which is included with my cmakelists.txt with

                    QT5_ADD_RESOURCES(RES_SOURCES
                      resources/resources.qrc
                      )
                    

                    Images are used in the ui_headers with lines like

                    <string notr="true">background-image: url(:/images/background.svg)
                    

                    the folder images is a sub directory in resources.

                    I'm fine with coping by hand, but I'm not sure where in the app bundle the images should end up.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @DJ-Ogurt ah ok,
                    when all your images are part of the qrc file than they should be part of the binary, and you shouldn't have any more work with it. So I'm kind of out of ideas .

                    One last one, all those images that are not displayed/missing, do they happen to be svg files?

                    Maybe QtSvg.framework was not copied correctly? You should check that.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    D 1 Reply Last reply
                    1
                    • J.HilkJ J.Hilk

                      @DJ-Ogurt ah ok,
                      when all your images are part of the qrc file than they should be part of the binary, and you shouldn't have any more work with it. So I'm kind of out of ideas .

                      One last one, all those images that are not displayed/missing, do they happen to be svg files?

                      Maybe QtSvg.framework was not copied correctly? You should check that.

                      D Offline
                      D Offline
                      DJ-Ogurt
                      wrote on last edited by DJ-Ogurt
                      #10

                      @J-Hilk
                      That's exactly what I thought. They are svg images and it seems that QtSvg.framework is in there. Here's a tree of the svg framework sub dir in Contents/Frameworks/QtSvg.framework/

                      my.app/Contents/Frameworks/QtSvg.framework/
                      ├── QtSvg -> Versions/Current/QtSvg
                      ├── Resources -> Versions/Current/Resources
                      └── Versions
                          ├── 5
                          │   ├── QtSvg
                          │   └── Resources
                          │       └── Info.plist
                          └── Current -> 5
                      
                      5 directories, 3 files
                      

                      This tree view is after the mac deploy has been run on the app bundle.

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Richicoder
                        wrote on last edited by
                        #11

                        Just ran into this issue myself. Did you end up finding a resolution?

                        M 1 Reply Last reply
                        0
                        • R Richicoder

                          Just ran into this issue myself. Did you end up finding a resolution?

                          M Offline
                          M Offline
                          mslazynski
                          wrote on last edited by
                          #12

                          @Richicoder
                          All frameworks are being copied correctly, the problem is with the svg plugin - you have to copy it later manually. On my MacBook I had to use those commands after using macdeployqt:

                          cd <bundle path>/Contents/PlugIns/imageformats
                          cp /usr/local/Cellar/qt/5.11.1/plugins/imageformats/libqsvg.dylib .
                          install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui libqsvg.dylib
                          install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets libqsvg.dylib
                          install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtSvg.framework/Versions/5/QtSvg @executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg libqsvg.dylib
                          install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore libqsvg.dylib
                          
                          1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            julrich
                            wrote on last edited by
                            #13

                            Related bug report: QTBUG-55199

                            1 Reply Last reply
                            1

                            • Login

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