Reputation: 907
On macOS systems, I am encountering a dynamic linking error - DYLD, [0x5] Code Signature error - when launching an application on systems other than my own (both Catalina and Mojave). Why my system works fine is not clear? My dylibs are loaded from the Frameworks folder of my app bundle. I can verify that the @rpaths the libraries use are working. Again, the libraries load fine on my system.
I can successfully notarize my app. The notarization tool and logs report no errors or warnings. The library that can not load in the crash report does indeed exist at the path reported. I can run 'spctl -a -t exec -vv MyFineApp.app' and the tool reports no errors. It said the bundle is accepted. Any ideas how I can better diagnose the issue as to why app runs on my computer and not others? Again, the report is that the code signature is invalid, but that is never reported elsewhere. The code signature for the library is below.
Executable=/Users/user/Library/Developer/Xcode/DerivedData/MyFineApp-fbtnvajmowfagrgjpeckdwwjzlid/Build/Products/Debug/MyFineApp.app/Contents/Frameworks/libavcodec.dylib
Identifier=libavcodec
Format=Mach-O thin (x86_64)
CodeDirectory v=20500 size=114006 flags=0x10000(runtime) hashes=3554+5 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=XXXXXXXX
CandidateCDHashFull sha256=XXXXXXXX
Hash choices=sha256
CMSDigest=ec6e734956d23494d115f6fa608f6d15a621a944a6d8b4210134b664b71523af
CMSDigestType=2
CDHash=XXXXXXXXX
Signature size=8933
Authority=Developer ID Application: Fake Name (XXXXXXX)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Apr 12, 2020 at 1:15:16 PM
Info.plist=not bound
TeamIdentifier=MYTEAM
Runtime Version=10.13.0
Sealed Resources=none
Internal requirements count=1 size=204
Crash Report
Termination Reason: DYLD, [0x5] Code Signature
Application Specific Information: dyld: launch, loading dependent libraries
Dyld Error Message: Library not loaded: @rpath/libavcodec.dylib Referenced from: /Applications/MyFineApp.app/Contents/MacOS/MyFineApp Reason: no suitable image found. Did find: /Applications/MyFineApp.app/Contents/MacOS/../Frameworks/libavcodec.dylib: code signature invalid for '/Applications/MyFineApp.app/Contents/MacOS/../Frameworks/libavcodec.dylib'
/Applications/MyFineApp.app/Contents/MacOS/../Frameworks/libavcodec.dylib: stat() failed with errno=1
Upvotes: 2
Views: 875
Reputation: 907
I addressed my issue with the help of Apple DTS. I set the -deep flag in OTHER CODE SIGNING FLAGS. This embedded entitlements into my dylibs which caused an issue with gatekeeper system. Don't do --deep unless you know what you are doing!!!
See below:
See “--deep
Considered Harmful”.
https://forums.developer.apple.com/thread/129980
https://forums.developer.apple.com/thread/128166
Upvotes: 1