Closed Priva28 closed 4 years ago
Hi!
...ediates.noindex/Previews/project/Products/Debug-iphonesimulator/libsodium.a
This file doesn't exist any more. Are you using the current version from this repository?
I'm also pretty sure that arm64 builds are present since the files have been created on a DTK :)
My installation method is a little weird but I don't see why it wouldn't work. Because I would prefer not to use CocoaPods, and SPM didn't work, I have created a seperate Sodium framework target then copied all of the Swift source files manually (from the latest commit), along with the Clibsodium.xcframework and this seems to be working.
Either way, I have created a test project to try using a CocoaPods install and the error (while slightly different) still occurs. I can build just fine on every other target except it doesn't work when using SwiftUI Previews.
Here is the full error this time:
SchemeBuildError: Failed to build the scheme "sodiumtest"
linker command failed with exit code 1 (use -v to see invocation)
Build target Sodium:
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'Sodium' from project 'Pods')
Link Sodium (arm64):
ld: in /Users/christian/Desktop/sodiumtest/Pods/Sodium/Sodium/libsodium/libsodium-ios.a(libsodium_la-aead_xchacha20poly1305.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Link sodiumtest (arm64):
ld: framework not found Sodium
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Link sodiumtest (x86_64):
ld: framework not found Sodium
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hmm seems like this may be an Apple issue. https://developer.apple.com/forums/thread/657913. The solution is to exclude arm64 from build architectures, but then this means running on device won't work. I wonder if it would work without this workaround for Apple Silicon?
If anyone else is having this problem here is a somewhat ok solution for now:
Create a new build Configuration for your project and call it "Previews". YourProject > Info > Configurations
For your app and the Sodium target, go to Build Settings > Architecture > Excluded Architectures
then expand it and add arm64
for the new configuration you created.
Now go to Manage Schemes > YourApp
then select the gear and duplicate
Then edit and change the build configuration to the one you created.
Now whenever you want to use previews, simply just select your new scheme and it will compile! When you want to use the simulator or your device, switch back to the original scheme.
This can probably be closed now.
Adding a "me too" on that thread so that the bug gets Apple developers' attention can be also be useful.
We've seen really bad regressions introduced in Xcode beta versions that eventually went into releases (such as the alignment bug in Xcode 10), so the more exposure actual bugs (vs regular questions) get in the dev forums, the better :)
Hi! Sodium is working great so far and I've finally got it working with iOS, Catalyst and Simulators but have one last problem. SwiftUI Previews. For whatever reason, it seems that it needs the x86_64 and arm64 builds simultaneously or something. I'm no expert with this stuff so not really sure how to go about fixing this.
The error is
linker command failed with exit code 1 (use -v to see invocation)
Followed by this long error:
If you'd like to reproduce the error, all you need to do is add a SwiftUI view to the iOS Example in the source code, then try to open the preview. You should see 100s of undefined symbol errors.
Hopefully someone can help, Thanks!