Sudden dyld: Library not loaded, no suitable image found, code signature invalid

Suddenly between 07/March/22 and 11/March/22 my entire team stopped to be able to create a non-crashing build for our macOS app.

The project builds correctly but the app crashes with:

dyld: Library not loaded: @rpath/[redacted]/Versions/A/[redacted]
  Referenced from: /Users/[redacted]/Library/Developer/Xcode/DerivedData/[redacted]-afjccazdqnhlzphdcplakowpjfyi/Build/Products/Release/MyApp.app/Contents/MacOS/MyApp
  Reason: no suitable image found.  Did find:
	/Users/[redacted]/Library/Developer/Xcode/DerivedData/[redacted]-afjccazdqnhlzphdcplakowpjfyi/Build/Products/Release/MyApp.app/Contents/MacOS/../Frameworks/[redacted].framework/Versions/A/[redacted]: code signature invalid for '/Users/[redacted]/Library/Developer/Xcode/DerivedData/[redacted]-afjccazdqnhlzphdcplakowpjfyi/Build/Products/Release/MyApp.app/Contents/MacOS/../Frameworks/[redacted].framework/Versions/A/[redacted]'

Summary: no suitable image found. and code signature invalid

In console we see:

error	12:33:50.270929+0000	taskgated-helper	ConfigurationProfiles	com.apple.ManagedClient	ProvisioningProfiles	Disallowing org.cocoapods.[redacted] because no eligible provisioning profiles found

error	12:33:50.271244+0000	amfid	amfid	com.apple.MobileFileIntegrity	amfid	CPValidateProvisioningDictionariesExtViaBridge returned invalid result: {
    success = 0;
}

This is the signature pf the above framework from inside the application bundle:

The framework crashing is a Pod and our project has a mix of pods and swift packages.

We tried to build several older commits thinking we screwed up something in the project but the result is not changing, so seems obvious the issue is in the environment. We are using Xcode 13.2.1 on macOS 11.6.5 (yeah, IT is blocking macOS 12 upgrade)

We cleaned the project, re-downloaded all certificates and changed our signing from manual to automatic, just for testing. No changes.

I'm aware of changes in certificates and some known problems on Xcode <13.4 but the timing doesn't match exactly.

Any clue?


Additional info:

This is just one of the components crashing, other binaries are crashing for the same reason but different frameworks.

This is a comparison between the framework with the invalid signature and the same framework from an old working build

Working:

sudo codesign -dv [redacted].framework --extract-certificates
Password:
Executable=/Applications/[redacted].app/Contents/Frameworks/[redacted]g.framework/Versions/Current/[redacted]
Identifier=org.cocoapods.[redacted]
Format=bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20400 size=1092 flags=0x0(none) hashes=27+3 location=embedded
Signature size=8960
Timestamp=1 Feb 2022 at 13:00:40
Info.plist entries=20
TeamIdentifier=[redacted]
Sealed Resources version=2 rules=13 files=1
Internal requirements count=1 size=192



Crashing:

sudo codesign -dv [redacted].framework --extract-certificates
Password:
Executable=/Users/[redacted]/Developer/[redacted]/Builds/Release/InstallerComponents.dst/Applications/[redacted].app/Contents/Frameworks/[redacted].framework/Versions/Current/[redacted]
Identifier=org.cocoapods.[redacted]
Format=bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=1164 flags=0x10000(runtime) hashes=27+5 location=embedded
Signature size=8961
Timestamp=15 Mar 2022 at 11:15:56
Info.plist entries=20
TeamIdentifier=[redacted]
Runtime Version=12.1.0
Sealed Resources version=2 rules=13 files=1
Internal requirements count=1 size=224
Answered by kappe_m in 707372022

-_- issue solved after 3 days of headbanging. We added a --deep flag to OTHER_CODE_SIGN_FLAGS to our main target and that screwed everything. The uni tests passed and nobody noticed until last week.

Case closed.

Accepted Answer

-_- issue solved after 3 days of headbanging. We added a --deep flag to OTHER_CODE_SIGN_FLAGS to our main target and that screwed everything. The uni tests passed and nobody noticed until last week.

Case closed.

-_- issue solved after 3 days of headbanging. We added a --deep flag to OTHER_CODE_SIGN_FLAGS to our main target and that screwed everything. The uni tests passed and nobody noticed until last week.

Case closed.

We added a --deep flag to OTHER_CODE_SIGN_FLAGS to our main target and that screwed everything.

Oi vey! I recognise that this is too late but…

--deep Considered Harmful

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sudden dyld: Library not loaded, no suitable image found, code signature invalid
 
 
Q