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. Error codesigning frameworks on Xcode
Forum Updated to NodeBB v4.3 + New Features

Error codesigning frameworks on Xcode

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 5 Posters 2.1k Views 4 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
    DarioA
    wrote on 18 Sept 2019, 15:03 last edited by
    #1

    I'm using the Qt dynamic frameworks (5.13.1) in a macOS targeted project, built w/in Xcode. The Qt frameworks are all of the format:

    Qt5SomeFramework.framework
      Headers                      -> Versions/Current/Headers
      Resources                    -> Versions/Current/Resources
      Versions
        5
          Headers
          Resources
          Qt5SomeFramework
          Qt5SomeFramework_debug
        Current                    -> 5
      QtSomeFramework              -> Versions/Current/Qt5SomeFramework
      QtSomeFramework.prl          -> Versions/Current/Qt5SomeFramework.prl
      QtSomeFramework_debug        -> Versions/Current/Qt5SomeFramework_debug
      QtSomeFramework_debug.prl    -> Versions/Current/Qt5SomeFramework_debug.prl
    

    This causes an error when Xcode builds and reaches the codesigning stage. It's specifically looking to codesign something located at QtSomeFramework.framework/Versions/A/QtSomeFramework, which doesn't exist and is failing to build.

    I've gone down a rabit hole of:

    • Renaming the Versions/5 directory to Versions/A and then updating the symlinks in the framework bundle to accordingly
    • Using otool to list the load paths in the binary/so and install_name_tool to modify them Qt load paths
    • Removing the *_debug and *.prl files as they interfere with code signing as well

    But now I'm seeing that all the other dylibs and bins in the Qt installation are pointing to Versions/5. For instance, plugins/platforms/libqcocoa.dylib also needs to have otool and install_name_tool run on it, as do others. Before continuing down this rabbit hole of updating every single dynamic library and executable in the Qt installation, is there something that I'm missing here? Some googling suggests using macdeployqt, but that's not working either and I can't even get it run before codesigning w/in Xcode.

    Any help would be appreciated. Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Sept 2019, 18:38 last edited by
      #2

      Hi,

      How did you install Qt ?
      What version of Xcode are you using ?

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

      D 1 Reply Last reply 18 Sept 2019, 19:33
      0
      • S SGaist
        18 Sept 2019, 18:38

        Hi,

        How did you install Qt ?
        What version of Xcode are you using ?

        D Offline
        D Offline
        DarioA
        wrote on 18 Sept 2019, 19:33 last edited by
        #3

        @sgaist I installed it using the online installer, which downloaded the prebuilt binaries. It installed to $HOME/Qt/5.13.1/clang_64
        Xcode Version: 10.2.1 (10E1001)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 18 Sept 2019, 21:02 last edited by
          #4

          What parameters are you passing to macdeployqt ?

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

          D 2 Replies Last reply 19 Sept 2019, 07:07
          0
          • S SGaist
            18 Sept 2019, 21:02

            What parameters are you passing to macdeployqt ?

            D Offline
            D Offline
            DarioA
            wrote on 19 Sept 2019, 07:07 last edited by DarioA
            #5

            @sgaist I call macdeployqt like this:

            /Users/dario/Dev/ThirdPartyLibs/Qt/Qt-5.13.1-OSX-dynamic/bin/macdeployqt /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app ${CODESIGNING_FOLDER_PATH} -codesign="Mac Developer: XXXXXXXXXXXXXXXXXX"
            

            and get the following results:

            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui_debug\n"
            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore_debug\n"
            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets_debug\n"
            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork_debug\n"
            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtMultimedia.framework/Versions/5/QtMultimedia: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtMultimedia.framework/Versions/5/QtMultimedia_debug\n"
            ERROR: Codesign signing error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/MacOS/MyProject: code object is not signed at all\nIn subcomponent: /Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app/Contents/Frameworks/QtGui.framework\n"
            ERROR: codesign verification error:
            ERROR: "/Users/dario/Dev/Builds/MyProject/DerivedData/MyProject/Build/Products/Debug/MyProject.app: code object is not signed at all\nIn architecture: x86_64\n"
            
            1 Reply Last reply
            0
            • D Offline
              D Offline
              DarioA
              wrote on 19 Sept 2019, 07:34 last edited by
              #6

              Ah, I got it (I think)! So, Qt's frameworks are dynamic, which means that when you add them to your project in Xcode, Xcode adds them to an "Embed Frameworks" build phase, which copies the framework files into the app bundle at build time and codesigns them. However, macdeployqt seems to want to do that part of the job. So, if I just link with the frameworks but don't add the frameworks to the "Embed Frameworks", then run macdeployqt, the depploy tool will handle that part of the build process, and even code signing.

              Does that sound right to you?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DarioA
                wrote on 19 Sept 2019, 14:45 last edited by
                #7

                So, I was able to get this working. I had to:

                • Make sure the Qt frameworks were getting linked with, but not copied in and signed in the "Embedded Binaries" Xcode section
                • Add a ShellScriptBuildPhase which calls macdeployqt passing in the .app path and optionally -use-debug-libs if the CONFIGURATION environment variable is DEBUG. Note that I am not code signing here because macdeployqt wants an unambiguous code signing identity (e.g. "Mac Developer: Dario XXXXXXX") but that may change per developer and I don't want to hard code that in to the shell shell script.
                • I need to add --deep to the project's OTHER_CODE_SIGN_FLAGS to tell Xcode's codesign build step to codesign the Qt frameworks and plugins.
                H 1 Reply Last reply 26 Oct 2019, 07:02
                1
                • D Offline
                  D Offline
                  DarioA
                  wrote on 19 Sept 2019, 17:04 last edited by DarioA
                  #8

                  Hmmm, looks like the Debug builds are not quite working right. Building is successful but I'm getting a crash on launch. It appears the _debug binaries are pointing to release frameworks and not finding them since only the _debug binaries are in the frameworks. For instance, here is otool -L output run on the QtMultimediaWidgets_debug embedded into the app by macdeployqt:

                  	@rpath/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets_debug (compatibility version 5.13.0, current version 5.13.1)
                  	@rpath/QtMultimedia.framework/Versions/5/QtMultimedia (compatibility version 5.13.0, current version 5.13.1)
                  	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.13.0, current version 5.13.1)
                  	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.13.0, current version 5.13.1)
                  	@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.13.0, current version 5.13.1)
                  	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.13.0, current version 5.13.1)
                  	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
                  	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
                  	@rpath/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.13.0, current version 5.13.1)
                  	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
                  	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
                  	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
                  	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
                  

                  That doesn't seem right.

                  1 Reply Last reply
                  0
                  • S SGaist
                    18 Sept 2019, 21:02

                    What parameters are you passing to macdeployqt ?

                    D Offline
                    D Offline
                    DarioA
                    wrote on 20 Sept 2019, 11:11 last edited by
                    #9

                    @sgaist So, I the prebuilt _debug frameworks that are downloaded using the online installer, are they supposed to be referencing/loading debug or release versions of other libraries? I just freshly redownloaded 5.13.1 for macOS and running otool on one of the _debug binaries shows that they point to the release versions. Is that right?

                    $ otool -L /Users/dario/Qt/5.13.1/clang_64/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets_debug 
                    /Users/dario/Qt/5.13.1/clang_64/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets_debug:
                    	@rpath/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets_debug (compatibility version 5.13.0, current version 5.13.1)
                    	@rpath/QtMultimedia.framework/Versions/5/QtMultimedia (compatibility version 5.13.0, current version 5.13.1)
                    	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.13.0, current version 5.13.1)
                    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.13.0, current version 5.13.1)
                    	@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.13.0, current version 5.13.1)
                    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.13.0, current version 5.13.1)
                    	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
                    	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
                    	@rpath/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.13.0, current version 5.13.1)
                    	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
                    	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
                    	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
                    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
                    
                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DarioA
                      wrote on 20 Sept 2019, 12:33 last edited by
                      #10

                      OK, so according to this bug report https://bugreports.qt.io/browse/QTBUG-48800, I need to add the DYLD_IMAGE_SUFFIX=_debug environment variable when running in debug mode. Feels like it would be better for _debug binaries to reference other _debug binaries. If not that, then the need for this environment variable when using -use-debug-libs should be documented.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 20 Sept 2019, 21:58 last edited by
                        #11

                        Sorry I misread your first line, I thought you were using Qt Creator to build your project.

                        I must I'm also surprised but I haven't been in a situation requiring to deploy a debug version of an application.

                        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
                        1
                        • D DarioA
                          19 Sept 2019, 14:45

                          So, I was able to get this working. I had to:

                          • Make sure the Qt frameworks were getting linked with, but not copied in and signed in the "Embedded Binaries" Xcode section
                          • Add a ShellScriptBuildPhase which calls macdeployqt passing in the .app path and optionally -use-debug-libs if the CONFIGURATION environment variable is DEBUG. Note that I am not code signing here because macdeployqt wants an unambiguous code signing identity (e.g. "Mac Developer: Dario XXXXXXX") but that may change per developer and I don't want to hard code that in to the shell shell script.
                          • I need to add --deep to the project's OTHER_CODE_SIGN_FLAGS to tell Xcode's codesign build step to codesign the Qt frameworks and plugins.
                          H Offline
                          H Offline
                          hpasa
                          wrote on 26 Oct 2019, 07:02 last edited by
                          #12

                          @DarioA I just ran into the same issue. To me it looks like a bug somewhere, possibly in the way that Qt frameworks are setup, that the Version/A is referenced. I'm using XCode 11.1, and I would expect "Embed & Sign" to work for Qt frameworks as well.

                          1 Reply Last reply
                          1
                          • E Offline
                            E Offline
                            Emma55
                            wrote on 26 Oct 2019, 09:02 last edited by Emma55 11 Apr 2019, 05:12
                            #13

                            Same issue here. The only workaround I've found is to use static library instead of framework. dgcustomerfirst

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              DarioA
                              wrote on 28 Oct 2019, 08:56 last edited by
                              #14

                              @hpasa and @Emma55 see https://forum.qt.io/post/551916 for how I was able to get this to work with dynamic frameworks. This is the post build script I added:

                              /Path/To/Qt/bin/macdeployqt ${CODESIGNING_FOLDER_PATH}
                              

                              Which will not link to debug binaries as that still appears to be an open issue.

                              Definitely feels like using Qt in Xcode is a second class citizen

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                Kerndog73
                                wrote on 12 Dec 2019, 01:54 last edited by
                                #15

                                I thought macdeployqt was supposed to be a helper for deploying to macOS using Qt Creator. I thought that it was just copying and code signing frameworks but that doesn't seem to be the case. It should be possible to do whatever the tool does in Xcode but I can't figure it out. Just telling Xcode to embed and sign the frameworks isn't enough. To me, this seems like there's something wrong with the way the frameworks are built. Or maybe I just don't understand what macdeployqt does (or is meant to do).

                                D 1 Reply Last reply 12 Dec 2019, 03:26
                                0
                                • K Kerndog73
                                  12 Dec 2019, 01:54

                                  I thought macdeployqt was supposed to be a helper for deploying to macOS using Qt Creator. I thought that it was just copying and code signing frameworks but that doesn't seem to be the case. It should be possible to do whatever the tool does in Xcode but I can't figure it out. Just telling Xcode to embed and sign the frameworks isn't enough. To me, this seems like there's something wrong with the way the frameworks are built. Or maybe I just don't understand what macdeployqt does (or is meant to do).

                                  D Offline
                                  D Offline
                                  DarioA
                                  wrote on 12 Dec 2019, 03:26 last edited by
                                  #16

                                  @Kerndog73 I agree completely. The frameworks that Qt builds and distributes are non-standard and Xcode just can't deal with them. Modifying them doesn't work either, as you can see from my OP. I think they just need to be built differently. After much trial and error, I gave up and tried macdeployqt and it seemed to do what was necessary. Definitely would like to see Qt move towards using standard frameworks.

                                  1 Reply Last reply
                                  2

                                  • Login

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