maxgoedjen / secretive

Store SSH keys in the Secure Enclave
MIT License
7.16k stars 157 forks source link

Unable to build current source #561

Closed mortax closed 1 month ago

mortax commented 1 month ago

i'm sorry to admit that i'm not an Xcode expert. that said, i'm getting these errors when i try to build the current source (on Sonoma 14.6.1 (23G93) using Xcode Version 15.4 (15F31d)). annoyingly, these are phrased as if they should be ignorable (i.e. don't encode Swift 6 semantics) but i haven't found a way to ignore them.

Agent
.../secretive/Sources/Packages/Sources/SecretAgentKit/Agent.swift
.../secretive/Sources/Packages/Sources/SecretAgentKit/Agent.swift:38:24 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6

Product
.../secretive/Sources/Packages/Sources/SecretAgentKit/Agent.swift
/Users/jrd/github/secretive/Sources/Packages/Sources/SecretAgentKit/Agent.swift:38:24 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6

SecureEnclaveSecretKit
.../secretive/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift
.../secretive/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift:214:5 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6
.../secretive/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift:307:20 Static property 'keyTag' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

.../secretive/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift:308:20 Static property 'keyType' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

SmartCardSecretKit
.../secretive/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift
.../secretive/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift:120:5 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6

any advice?

mortax commented 1 month ago

@maxgoedjen can you delete the attempt to infect my computer? ☝️ (lol. a windows virus wouldn't have even worked.)

YoungAgile commented 1 month ago

@maxgoedjen can you delete the attempt to infect my computer? ☝️ (lol. a windows virus wouldn't have even worked.)

Sorry, the account has been hacked. Please do not click on this link.

maxgoedjen commented 1 month ago

@maxgoedjen can you delete the attempt to infect my computer? ☝️ (lol. a windows virus wouldn't have even worked.)

@mortax did this get deleted by the time I got here? I don't see anything else up there.

maxgoedjen commented 1 month ago

@mortax overall on this issue: I'm working on getting it building in Swift 6 mode currently, but in the short term you can remove the "CompleteConcurrency" flags in Package.swift

mortax commented 1 month ago

thanks @maxgoedjen. indeed, the comment was already deleted (not that anyone else would be taken in).

thanks for the tip. i've removed StrictConcurrency from Package.swift and am having another go. (dang it -- i should have been able to find that but it was a little beyond my Xcode knowledge.)

maxgoedjen commented 1 month ago

@mortax I turned that on back when it built, but new concurrency warnings have come on since. I'll disable that in main since it's becoming a semi-common question.

mortax commented 1 month ago

that change certainly helped. Xcode is annoying in that, after making a build configuration change, i always seem to have to use Product -> Clean Build Folder... (⇧ ⌘ K) to make Xcode rebuild properly/fully with the updated configuration. in my case, i also had to update the Swift Compiler - Language configured in Build Settings for each target.

the code changes used

``` diff --git Sources/Packages/Package.swift Sources/Packages/Package.swift index 39d9a99..9fa196a 100644 --- Sources/Packages/Package.swift +++ Sources/Packages/Package.swift @@ -34,27 +34,27 @@ let package = Package( .target( name: "SecretKit", dependencies: [], - swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])] + swiftSettings: [.unsafeFlags(["-warnings-as-errors"])] ), .testTarget( name: "SecretKitTests", dependencies: ["SecretKit", "SecureEnclaveSecretKit", "SmartCardSecretKit"], - swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])] + swiftSettings: [.unsafeFlags(["-warnings-as-errors"])] ), .target( name: "SecureEnclaveSecretKit", dependencies: ["SecretKit"], - swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])] + swiftSettings: [.unsafeFlags(["-warnings-as-errors"])] ), .target( name: "SmartCardSecretKit", dependencies: ["SecretKit"], - swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])] + swiftSettings: [.unsafeFlags(["-warnings-as-errors"])] ), .target( name: "SecretAgentKit", dependencies: ["SecretKit", "SecretAgentKitHeaders"], - swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])] + swiftSettings: [.unsafeFlags(["-warnings-as-errors"])] ), .systemLibrary( name: "SecretAgentKitHeaders" diff --git Sources/Secretive.xcodeproj/project.pbxproj Sources/Secretive.xcodeproj/project.pbxproj index 3e94e0e..c50ff59 100644 --- Sources/Secretive.xcodeproj/project.pbxproj +++ Sources/Secretive.xcodeproj/project.pbxproj @@ -707,7 +707,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Debug; @@ -737,7 +737,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Release; @@ -875,7 +875,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Test; @@ -924,7 +924,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Test; @@ -951,7 +951,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Debug; @@ -978,7 +978,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.apple.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; + SWIFT_STRICT_CONCURRENCY = minimal; SWIFT_VERSION = 5.0; }; name = Release; ```

i am still getting .../secretive/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift:214:5 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6 for SecureEnclaveStore, which i haven't been able to track down (yet).

maxgoedjen commented 1 month ago

That'll be fixed here: https://github.com/maxgoedjen/secretive/pull/562, should be merged in next few minutes.

mortax commented 1 month ago

sadly @maxgoedjen, i am still getting the @Sendable error for SmartCardStore -- even after repeatedly cleaning and rebuilding. even stranger, subsequent rebuilds tend to increase or decrease the number of errors (often including Command SwiftCompile failed with a nonzero exit code).

let me know if you have any thoughts. i was able to successfully build a year+ ago.

mortax commented 1 month ago

i get closest to a build (only one error -- unless i rebuild) if i remove this:

--- Sources/Packages/Package.swift
+++ Sources/Packages/Package.swift
@@ -34,7 +34,7 @@ let package = Package(
         .target(
             name: "SecretKit",
             dependencies: [],
-            swiftSettings: [.enableExperimentalFeature("StrictConcurrency"), .unsafeFlags(["-warnings-as-errors"])]
+            swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]
         ),
         .testTarget(
             name: "SecretKitTests",

then Clear All Issues and Clean Build Folder...:

Agent

.../secretive/Sources/Packages/Sources/SecretAgentKit/Agent.swift:38:24 Instance methods of non-Sendable types cannot be marked as '@Sendable'; this is an error in Swift 6

i can't eliminate that error, however.

maxgoedjen commented 1 month ago

@mortax just dump those changes and pull from main – it should build now (locally and CI both pass for me)

maxgoedjen commented 1 month ago

Ah looks like CI's Xcode is outdated and 15.4 does show that, my bad. Let me get that fixed up.

maxgoedjen commented 1 month ago

Give that one more go now that https://github.com/maxgoedjen/secretive/pull/564 is merged, please.

mortax commented 1 month ago

brilliant! that did the trick. i was able to build. i just have to fix my signing and i'm all set. thanks Max!