pqrs-org / Tinkle

https://tinkle.pqrs.org
The Unlicense
83 stars 4 forks source link

Code signing error #1

Closed blackketter closed 4 years ago

blackketter commented 4 years ago

Hi. Trying to follow the instructions to build Tinkle, getting the following error during code signing at the end of the build. The built app won't launch properly. Any suggestions on how to get it to build and run? Thanks!

bash scripts/codesign.sh tmp
code sign Tinkle.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app
error: The specified item could not be found in the keychain.
code sign Tinkle.app
error: The specified item could not be found in the keychain.
create-dmg --overwrite --identity='Developer ID Application: Fumihiko Takayama (G43BCU2T37)' tmp/Tinkle.app
ℹ Minimum runtime 10.15 detected, using ULFO format
✖ Code signing failed. The DMG is fine, just not code signed.
No suitable code signing identity found
make: *** [package] Error 2

The following is logged to the console when you try to launch the built app:

default 20:12:30.989695-0700    loginwindow -[ApplicationManager checkInAppContext:eventData:] | ApplicationManager: Checked in app : Tinkle
default 20:12:30.997282-0700    runningboardd   Resolved pid 98396 to [executable<Tinkle(502)>:98396]
default 20:12:31.001029-0700    runningboardd   [executable<Tinkle(502)>:98396] This process will not be managed.
default 20:12:31.001066-0700    runningboardd   Now tracking process: [executable<Tinkle(502)>:98396]
default 20:12:31.001698-0700    runningboardd   Acquiring assertion targeting executable<Tinkle(502)> from originator [daemon<com.apple.coreservices.launchservicesd>:244] with description <RBSAssertionDescriptor; uielement:98396; ID: 576-244-26125; target: 98396> attributes = {
    <RBSDomainAttribute: 0x7fe908623de0; domain: com.apple.launchservicesd; name: RoleUserInteractive; sourceEnvironment: 0x0>;
}
default 20:12:31.001846-0700    runningboardd   Assertion 576-244-26125 (target:executable<Tinkle(502)>) will be created as active
default 20:12:31.002695-0700    runningboardd   Acquiring assertion targeting executable<Tinkle(502)> from originator [daemon<com.apple.coreservices.launchservicesd>:244] with description <RBSAssertionDescriptor; uielement:98396; ID: 576-244-26126; target: 98396> attributes = {
    <RBSDomainAttribute: 0x7fe90ab24470; domain: com.apple.launchservicesd; name: RoleUserInteractive; sourceEnvironment: 0x0>;
}
default 20:12:31.002886-0700    runningboardd   [executable<Tinkle(502)>:98396] Ignoring jetsam update because this process is not memory-managed
default 20:12:31.003061-0700    runningboardd   Assertion 576-244-26126 (target:executable<Tinkle(502)>) will be created as active
default 20:12:31.003061-0700    runningboardd   [executable<Tinkle(502)>:98396] Ignoring resume because this process is not lifecycle managed
default 20:12:31.003321-0700    runningboardd   [executable<Tinkle(502)>:98396] Set darwin role to: UserInteractive
default 20:12:31.003477-0700    runningboardd   [executable<Tinkle(502)>:98396] Ignoring GPU update because this process is not GPU managed
default 20:12:31.004076-0700    runningboardd   Finished acquiring assertion 576-244-26126 (target:executable<Tinkle(502)>)
default 20:12:31.004483-0700    runningboardd   Invalidating assertion 576-244-26125 (target:executable<Tinkle(502)>) from originator 244
default 20:12:31.004796-0700    runningboardd   Finished acquiring assertion 576-244-26125 (target:executable<Tinkle(502)>)
default 20:12:32.410392-0700    kernel  AMFI: '/Users/dean/src/Tinkle/tmp/Tinkle.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle' is adhoc signed.
default 20:12:32.412332-0700    amfid   /Users/dean/src/Tinkle/tmp/Tinkle.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle signature not valid: -67050
default 20:12:32.414715-0700    runningboardd   [executable<Tinkle(502)>:98396] Death sentinel fired!
default 20:12:32.415532-0700    ReportCrash Parsing corpse data for process Tinkle [pid 98396]
default 20:12:32.417604-0700    loginwindow -[PersistentAppsSupport applicationQuit:] | for app:Tinkle, _appTrackingState = 2
default 20:12:32.421421-0700    runningboardd   Invalidating assertion 576-244-26126 (target:executable<Tinkle(502)>) from originator 244
default 20:12:32.499242-0700    ReportCrash Saved crash report for Tinkle[98396] version 1.0.0 (1.0.0) to Tinkle_2020-04-02-201232_lucky13.crash
default 20:12:32.524411-0700    runningboardd   Removing process: [executable<Tinkle(502)>:98396]
default 20:12:32.525239-0700    runningboardd   Removing assertions for terminated process: [executable<Tinkle(502)>:98396]
error   20:12:32.545099-0700    runningboardd   RBSStateCapture remove item called for untracked item 576-244-26126 (target:executable<Tinkle(502)>)
blackketter commented 4 years ago

Found this crashlog, seems that there's an issue with Sparkle:

Process:               Tinkle [98396]
Path:                  /Users/USER/*/Tinkle.app/Contents/MacOS/Tinkle
Identifier:            org.pqrs.Tinkle
Version:               1.0.0 (1.0.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Tinkle [98396]
User ID:               502

Date/Time:             2020-04-02 20:12:32.415 -0700
OS Version:            Mac OS X 10.15.4 (19E266)
Report Version:        12
Bridge OS Version:     4.4 (17P4263)
Anonymous UUID:        DBE691D3-9780-4F65-4EAA-540F0A8F98A4

Sleep/Wake UUID:       A82F01B8-9CF8-4CA7-8DB9-6A07BB2331C6

Time Awake Since Boot: 610000 seconds
Time Since Wake:       44000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x5] Code Signature

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/Sparkle.framework/Versions/A/Sparkle
  Referenced from: /Users/USER/*/Tinkle.app/Contents/MacOS/Tinkle
  Reason: no suitable image found.  Did find:
    /Users/dean/src/Tinkle/tmp/Tinkle.app/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/A/Sparkle: code signature in (/Users/dean/src/Tinkle/tmp/Tinkle.app/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/A/Sparkle) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
    /Users/dean/src/Tinkle/tmp/Tinkle.app/Contents/MacOS/../Frameworks/Sparkle.framework/Versions/A/Sparkle: stat() failed with errno=1

Binary Images:
       0x10f79e000 -        0x10f7cfff7 +org.pqrs.Tinkle (1.0.0 - 1.0.0) <0E784293-F64D-3FA8-A3B5-EEEEF0E1E2C7> /Users/USER/*/Tinkle.app/Contents/MacOS/Tinkle
       0x11abb9000 -        0x11ac4aeff  dyld (750.5) <1F893B81-89A5-3502-8510-95B97B9F730D> /usr/lib/dyld
tekezo commented 4 years ago

Replace CODESIGN_IDENTITY if you have your own certificate. https://github.com/pqrs-org/Tinkle/blob/master/scripts/codesign.sh#L6

If you do not have Apple Developer Certificates, remove Sparkle from Xcode project, and remove related code from Updater.swift. https://github.com/pqrs-org/Tinkle/blob/master/src/Tinkle/swift/Updater.swift#L6-L9 https://github.com/pqrs-org/Tinkle/blob/master/src/Tinkle/swift/Updater.swift#L6-L9 https://github.com/pqrs-org/Tinkle/blob/master/src/Tinkle/swift/Updater.swift#L6-L9

blackketter commented 4 years ago

Thanks so much!

tekezo commented 4 years ago

I improved the build to read codesign identity from the environment variable and exclude Sparkle automatically if there is not valid identity.

Follow this instruction. https://github.com/pqrs-org/Tinkle/#steps