jedisct1/swift-sodium

Validation fails with swift-sodium

chickahoona opened this issue · 5 comments

First thank you very much for providing this package. I was able to start implementing the necessary logic for Psono quite quickly, yet at the moment I am hitting a wall and hope that someone with more swift knowledge can help to solve.

I have an iOS App (source code can be found here https://gitlab.com/psono/psono-app/-/tree/ios-autofill) with Flutter with an "AutFill Credential Provider" Extension where I'd like to use swift-sodium. I have two targets, one for the app (Runner) and one for the Extension. I only "linked" Clipsodium and Sodium in the extension:

image

Archive and build always work flawless, also in simulator, yet when I "Validate" the app, then I already have problems with this option here:

image

Resulting in a "Symbols tool failed":

image

The logs show this error:

2021-01-01 20:24:34 +0000  Couldn't determine platform for <IDEDistributionItem: 0x7f833d555950; bundleID='(null)', path='<DVTFilePath:0x7f8334305d50:'/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 0
1.01.21, 21.23.xcarchive/Products/Applications/Runner.app/Frameworks/libsodium.a'>', codeSigningInfo='<_DVTCodeSigningInformation_Path: 0x7f8335013c20; isSigned='0', isAdHocSigned='0', signingCertificate='(null)', entitlem
ents='(null)', teamID='(null)', identifier='(null)', executablePath='(null)', hardenedRuntime='0'>'> (Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family for "libsodium.a"." UserInf
o={NSLocalizedDescription=Couldn't find platform family for "libsodium.a"., NSLocalizedRecoverySuggestion=Couldn't find CFBundleSupportedPlatforms in the Info.plist, LC_VERSION_MIN, or LC_BUILD_VERSION in the Mach-O for pa
th "/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 01.01.21, 21.23.xcarchive/Products/Applications/Runner.app/Frameworks/libsodium.a".})
2021-01-01 20:24:34 +0000  Couldn't determine platform for <IDEDistributionItem: 0x7f8335053bb0; bundleID='(null)', path='<DVTFilePath:0x7f833309c190:'/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 0
1.01.21, 21.23.xcarchive/Products/Applications/Runner.app/PlugIns/libsodium.a'>', codeSigningInfo='<_DVTCodeSigningInformation_Path: 0x7f833d570770; isSigned='0', isAdHocSigned='0', signingCertificate='(null)', entitlement
s='(null)', teamID='(null)', identifier='(null)', executablePath='(null)', hardenedRuntime='0'>'> (Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family for "libsodium.a"." UserInfo={
NSLocalizedDescription=Couldn't find platform family for "libsodium.a"., NSLocalizedRecoverySuggestion=Couldn't find CFBundleSupportedPlatforms in the Info.plist, LC_VERSION_MIN, or LC_BUILD_VERSION in the Mach-O for path
"/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 01.01.21, 21.23.xcarchive/Products/Applications/Runner.app/PlugIns/libsodium.a".})
2021-01-01 20:24:34 +0000  Couldn't determine platform for <IDEDistributionItem: 0x7f832f2eccc0; bundleID='(null)', path='<DVTFilePath:0x7f83337765f0:'/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 0
1.01.21, 21.23.xcarchive/Products/Applications/Runner.app/PlugIns/AutoFillExtension.appex/Frameworks/libsodium.a'>', codeSigningInfo='<_DVTCodeSigningInformation_Path: 0x7f83342787b0; isSigned='0', isAdHocSigned='0', signi
ngCertificate='(null)', entitlements='(null)', teamID='(null)', identifier='(null)', executablePath='(null)', hardenedRuntime='0'>'> (Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform fa
mily for "libsodium.a"." UserInfo={NSLocalizedDescription=Couldn't find platform family for "libsodium.a"., NSLocalizedRecoverySuggestion=Couldn't find CFBundleSupportedPlatforms in the Info.plist, LC_VERSION_MIN, or LC_BU
ILD_VERSION in the Mach-O for path "/Users/chickahoona/Library/Developer/Xcode/Archives/2021-01-01/Runner 01.01.21, 21.23.xcarchive/Products/Applications/Runner.app/PlugIns/AutoFillExtension.appex/Frameworks/libsodium.a".}

It would be nice to have these symbols, yet if necessary I could live without them. So I "unchecked" the symbol creation step and tried again.

Then I end up with this:

image

Any help would be much appreciated!

I think this issue is also related to issue #226, which I haven't been able to resolve yet. @chickahoona , are you able to do the Distribute App when you archive your project?

Hi @JakobOffersen As requested I tried it out. I am able to "Distribute App" when I select the "export option", yet when I select the "upload option" I get the same error as in the validation process before :(

image

Thanks alot for your help. Do you have a workaround somehow? An earlier version maybe? Otherwise I'd have to try to find another libsodium implementation, which I am sure will have it's own quirks :(

I am one step further. I can confirm that it has nothing to do with my setup, the extension or flutter or whatever. The problem appears on a complete new swift app once I add swift-sodium. Here is a small demo video (the qualtiy of the online viewer is crap, so you have to download it)

https://www.dropbox.com/s/r1s7zl6t4qziqdr/Screen%20Recording%202021-01-08%20at%2014.57.52.mov?dl=0

You will see the exact same errors popping up on a clean new ios app, and everything was working just right before I added swift-sodium

I am not sure if it helps anyone, yet I have now downgraded to version 0.8.0 which works.

Same issue on 0.9.1 ("Invalid Bundle" error on validating/distribution); the only solution worked for me was to integrate via Cocoapods instead of SPM. The only trick to fix the compilation errors was to specify framework linkage type in Podfile:

use_frameworks! :linkage => :static