Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run from source, archiving and exporting works #2056

Closed
ezfe opened this issue Jan 9, 2022 · 4 comments
Closed

Cannot run from source, archiving and exporting works #2056

ezfe opened this issue Jan 9, 2022 · 4 comments
Labels
2.x Sparkle 2.0

Comments

@ezfe
Copy link

ezfe commented Jan 9, 2022

Description of the problem

If I use Product > Archive and prepare a release version of my app, Sparkle works as expected.

If I use Product > Run (release or debug configuration, with or without "debug executable" checked), the app fails to launch:

Do you use Sandboxing in your app?

No.

Version of Sparkle.framework in the latest version of your app

2.0.0

Sparkle's output from Console.app

dyld[8434]: Library not loaded: @rpath/Sparkle.framework/Versions/B/Sparkle
  Referenced from: /Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/M1Craft UI.app/Contents/MacOS/M1Craft UI
  Reason: tried: '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/Sparkle.framework/Versions/B/Sparkle' (code signature in <B255A964-CEDF-36AD-B61B-3D5A8F41179E> '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/M1Craft UI.app/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/B/Sparkle' (code signature in <B255A964-CEDF-36AD-B61B-3D5A8F41179E> '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/M1Craft UI.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/M1Craft UI.app/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/B/Sparkle' (code signature in <B255A964-CEDF-36AD-B61B-3D5A8F41179E> '/Users/ezekielelin/Library/Developer/Xcode/DerivedData/M1Craft_UI-bkyiznndhqeunjedapiebccjniun/Build/Products/Debug/M1Craft UI.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Library/Frameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Library/Frameworks/Sparkle.framework/Versions/B/Sparkle' (no such file)

Steps to reproduce the behavior

I've attached a copy of the app from the DerivedData folder so that it exhibits the problem:

M1Craft UI.app.zip

Source project:

https://github.com/ezfe/m1craft

@ezfe ezfe added the 2.x Sparkle 2.0 label Jan 9, 2022
@zorgiepoo
Copy link
Member

zorgiepoo commented Jan 9, 2022

This has to do with hardened runtime's library validation. It wants Sparkle to be signed with the same signature as your app (which the Product > Archive process will do in the export process). It should work if Sparkle is set to Embed & Sign in the target settings but I notice your project doesn't have that any Embed options available, so I wonder if Xcode broke something recently.. Another workaround is disabling library validation only for debug/development. This isn't or shouldn't be specific to Sparkle.

@zorgiepoo
Copy link
Member

I'm also on a broken Xcode build actually, so I'm going to try upgrading and check again (#2043)

@zorgiepoo
Copy link
Member

Alright there's nothing broken about Xcode, just that a new blank project doesn't have hardened runtime automatically enabled.

I think you've two choices:

  1. Sign your project for Development instead of Sign to run Locally (for "Signing Certificate" under Signing & Capabilities). Ad-hoc signature (local signing) does not suffice when library validation is enabled.
  2. Disable library validation only for Debug/development.

@ezfe
Copy link
Author

ezfe commented Jan 11, 2022

I disabled Library Validation for debug only and that worked. Thanks!

@ezfe ezfe closed this as completed Jan 11, 2022
AngeloStavrow added a commit to writefreely/writefreely-swiftui-multiplatform that referenced this issue Feb 6, 2022
This fixes a crash-on-launch bug when running Product > Run from Xcode (Product > Archive should work correctly). See sparkle-project/Sparkle#2056 for more details.

Bug introduced by commit:
671b054
AngeloStavrow added a commit to writefreely/writefreely-swiftui-multiplatform that referenced this issue Apr 2, 2022
* Switch WriteFreely package import from ssh to https

* Sign macOS project target for Development

This fixes a crash-on-launch bug when running Product > Run from Xcode (Product > Archive should work correctly). See sparkle-project/Sparkle#2056 for more details.

Bug introduced by commit:
671b054

* Update Sparkle to v2.0 from official repo

Previously, we forked the repo to the WriteFreely org because Sparkle didn't support tag-based SPM updates. We therefore had to pull from the `master` branch, so forking insulated us from unexpected changes.

As of 2.x Sparkle now allows for tag-based updating via SPM; we'll allow patch updates but stop short of 2.1 until we can vet changes.

* Add MacUpdatesViewModel ObservableObject

* Use MacUpdatesViewModel to handle Sparkle update logic
AngeloStavrow added a commit to writefreely/writefreely-swiftui-multiplatform that referenced this issue Apr 2, 2022
* Set "recommended project settings" for Mac app

* Add default fallback for font typingAttribute

* Clean up linter errors

* Update extension iconset

* Fix spm errors and upgrade sparkle (#203)

* Switch WriteFreely package import from ssh to https

* Sign macOS project target for Development

This fixes a crash-on-launch bug when running Product > Run from Xcode (Product > Archive should work correctly). See sparkle-project/Sparkle#2056 for more details.

Bug introduced by commit:
671b054

* Update Sparkle to v2.0 from official repo

Previously, we forked the repo to the WriteFreely org because Sparkle didn't support tag-based SPM updates. We therefore had to pull from the `master` branch, so forking insulated us from unexpected changes.

As of 2.x Sparkle now allows for tag-based updating via SPM; we'll allow patch updates but stop short of 2.1 until we can vet changes.

* Add MacUpdatesViewModel ObservableObject

* Use MacUpdatesViewModel to handle Sparkle update logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Sparkle 2.0
Projects
None yet
Development

No branches or pull requests

2 participants