Problems running Mac application that imports dynamic libraries via SPM

I have been working on a Mac app that until recently didn't have a hardened runtime, but was enabled since it needs iCloud/CloudKit support and that's required for the entitlement. Now though, I can't run the application (even in debug) unless I have "Disable Library Validation" checked.

I don't believe the disable library validation is allowed for submission to the MAS (which is how I plan to distribute), but without that, building and running my application locally impossible since crashes on launch with a code signature invalid error. This also is causing my SwiftUI previews to go insane and die (the same error below pops up in the canvas regardless of the library validation setting).

I suspect it has to do with SPM, but I dunno.. maybe it's something that I've done... this is what I am getting:

dyld: Library not loaded: @rpath/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct
  Referenced from: /(super/long/path)/Build/Products/Debug/MyApplication.app/Contents/MacOS/MyApplication
  Reason: no suitable image found.  Did find:
	/(super/long/path)/Build/Products/Debug/PackageFrameworks/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct: code signature in (/(super/long/path)/Build/Products/Debug/PackageFrameworks/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct) 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.
	/(super/long/path)/Build/Products/Debug/MyApplication.app/Contents/MacOS/../Frameworks/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct: code signature invalid for '/(super/long/path)/Build/Products/Debug/MyApplication.app/Contents/MacOS/../Frameworks/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct'

	/(super/long/path)/Build/Products/Debug/MyApplication.app/Contents/MacOS/../Frameworks/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct.framework/Versions/A/3rdPartyFramework_38E624E3CA89CFDE_PackageProduct: stat() failed with errno=1
(lldb) 

I have an app dependency structure that works somewhat like this:

//            ┌───┐
//      ┌─────┤app├───────┐
//      │     └─┬─┘       │
//      │       │         │
//      │       │         │
// ┌────▼────┐  │  ┌──────▼──────┐
// │internal │  │  │SPM 1st party│
// │framework│  │  │framework    │
// └────────┬┘  │  └─┬───────────┘
//          │   │    │
//          │   │    │
//          │   │    │
//         ┌▼───▼────▼┐
//         │SPM       │
//         │3rd party │
//         │framework │
//         │dependency│
//         └──────────┘

There's my app, a framework embedded into the project, and two frameworks imported via SPM and all depend on and import 3rdPartyFramework (except that, of course). I think it is a binary framework I read something about bugs with SPM and signing here? Unsure if actually related. And the framework is RxSwift, if curious.

From what I understand, I'd need to manually sign these frameworks to myself if I were to distribute the application (either myself or through the app store) but at this point, I am just trying to get it to run while working on it again - is this something I'd need to do each time I launch the app from Xcode...? Along with that, when I do try to go in and code sign the frameworks manually (either myself with Terminal or through a run script), I am getting an error along the lines of "code object is not signed at all (SPM 1st Party Framework Path) In subcomponent (SPM 3rd Party Framework Path)".

So I clearly don't know what I am doing — any help would be appreciated.

Replies

Now though, I can't run the application (even in debug) unless I have Disable Library Validation checked.

There are too many moving parts for me to help you out here on DevForums. If no one else chimes in my advice is that you open a DTS tech support incident and we’ll try to help you out one on one.

Share and Enjoy

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

  • Thanks for chiming in! Haha yeah… I’ll likely do that today, I’ve got no clue what I am doing :)

Add a Comment