Signing a Qt5 application

Hello all,


I have a Qt-based application which want to sign with my new development certificate. I picked a Developer ID Application because it shall be distributed outside the Apple store via a DMG-Download.


So - I received the new certificate, installed it on my keychain. Then I signed the app:


soulalex@alexandarotsMBP SJC % codesign --deep --force --verify --verbose --timestamp --options runtime --sign "Developer ID Application: Alexander Carot (92C65YCLK8)" ./soundjack.app
./soundjack.app: signed app bundle with Mach-O thin (x86_64) [com.yourcompany.soundjack]



Now I verified it:


soulalex@alexandarotsMBP SJC % codesign --verify --deep --strict --verbose=2 ./soundjack.app
./soundjack.app: valid on disk
./soundjack.app: satisfies its Designated Requirement



Afterwards the problem is that the application crashes which is not the case without the signature:


soulalex@alexandarotsMBP SJC % ./soundjack.app/Contents/MacOS/soundjack
dyld: Library not loaded: @rpath/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets
Referenced from: /Users/soulalex/Desktop/wip/XP-shared/Soundjack/SJC/./soundjack.app/Contents/MacOS/soundjack
Reason: no suitable image found. Did find:
/Users/soulalex/Qt-5.14.2/5.14.2/clang_64/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets: code signature in (/Users/soulalex/Qt-5.14.2/5.14.2/clang_64/lib/QtMultimediaWidgets.framework/Versions/5/QtMultimediaWidgets) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
zsh: abort ./soundjack.app/Contents/MacOS/soundjack
soulalex@alexandarotsMBP SJC %



Can anyone help ?

Thanks a lot in advance,

best


Alex

Replies

Please don't use "--deep" and "--force" to sign anything.


Are you embedding your framework inside your app? And signing it properly? What happens when you test it in a VM that isn't your development machine with Qt already installed?

As john daniel says, don’t use

--deep
. See my
--deep
Considered Harmful post for an explanation as to why.

Rather, I sign each item separately, from the inside out. See Signing a Mac Product For Distribution and, for a concrete example, Manual Code Signing Example.

Once you’ve got everything sorted, I recommend you test using the procedure described in Testing a Notarised Product.

Finally, there are links to lots of other resources in the App Sandbox, Developer ID, Notarisation pinned post.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

>>Please don't use "--deep" and "--force" to sign anything.


I did it also without but it didn't make a difference.


>>Are you embedding your framework inside your app?


I am signing the app directly after the build. Deployment is realized afterwards but I haven't done it because the app crashes after the signature already (it does not without).


>>And signing it properly?


Yes, see above - it is also verified.


>>What happens when you test it in a VM that isn't your development machine with Qt already installed?


See above - it crashes already on my own machine before deployment.


Best


Alex

I asked if you are embedding the framework inside the app. When you do that, it will use the embedded framework. If you haven't done that, it is going to use what it can find on your system, which apparently isn't signed.

Got it - this helped me to better unstand the signing procedure !


This is turn leads to the next question:


The deployment as a DMG-File is realized via the macdeployqt call.


Do I understand correctly that I have to sign the final reployed DMG file ?


Alternatively I could apply macdeployqt without creating a DMG file, then sign the result and then create a DMG of it.


What makes most sense ?


Thanks,

best


Alex

Also thanks a lot to you. I will investigate asap and get back.