VirgilSecurity / virgil-crypto-x

Virgil Crypto stack Objective-C/Swift
https://virgilsecurity.com/
Other
34 stars 9 forks source link

Building v3.2 with Carthage #25

Closed bryjch closed 4 years ago

bryjch commented 5 years ago

Hello,

I am attempting to use Carthage to build version 3.2.3 this library and am encountering an error while building Using Xcode 11.0 / Swift 5.1.


Xcode version: 11.0

Swift version: 5.1

Cartfile:

github "VirgilSecurity/virgil-sdk-x" == 5.8.0
github "VirgilSecurity/virgil-crypto-x" == 3.2.3

Error:

CompileSwift normal x86_64 (in target 'VirgilCrypto macOS' from project 'VirgilCrypto')
    cd /Users/ExampleApp/ios/Carthage/Checkouts/virgil-crypto-x
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/ExampleApp/ios/Carthage/Checkouts/virgil-crypto-x/VirgilCrypto/Source/Pythia/VirgilPythia.swift /Users/ExampleApp/ios/Carthage/Checkouts/virgil-crypto-x/VirgilCrypto/Source/Pythia/BlindResult.swift -emit-module-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilCrypto.swiftmodule -emit-module-doc-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilCrypto.swiftdoc -serialize-diagnostics-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilCrypto\ macOS-master.dia -emit-objc-header-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilCrypto-Swift.h -emit-dependencies-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilCrypto\ macOS-master.d -target x86_64-apple-macos10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/BuildProductsPath/Release -F /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/BuildProductsPath/Release -application-extension -g -import-underlying-module -module-cache-path /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -O -serialize-debugging-options -Xcc -working-directory -Xcc /Users/ExampleApp/ios/Carthage/Checkouts/virgil-crypto-x -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/VirgilCrypto-generated-files.hmap -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/VirgilCrypto-own-target-headers.hmap -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/VirgilCrypto-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/VirgilCrypto-project-headers.hmap -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/BuildProductsPath/Release/include -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/DerivedSources-normal/x86_64 -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/DerivedSources/x86_64 -Xcc -I/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/DerivedSources -Xcc -ivfsoverlay -Xcc /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/unextended-module-overlay.yaml -module-name VirgilCrypto -num-threads 8 -o /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/VirgilPythia.o -o /Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto\ macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VirgilCrypto\ macOS.build/Objects-normal/x86_64/BlindResult.o
/Users/Bryan/Library/Caches/org.carthage.CarthageKit/DerivedData/11.0_11A420a/virgil-crypto-x/3.2.3/Build/Intermediates.noindex/ArchiveIntermediates/VirgilCrypto macOS/IntermediateBuildFilesPath/VirgilCrypto.build/Release/VSCCrypto macOS.build/module.modulemap:2:10: error: header 'pythia/pythia_buf.h' not found
  header "pythia/pythia_buf.h"
         ^
/Users/ExampleApp/ios/Carthage/Checkouts/virgil-crypto-x/VirgilCrypto/Source/Pythia/VirgilPythia.swift:38:8: error: could not build Objective-C module 'VSCCrypto'
import VSCCrypto
       ^

** ARCHIVE FAILED **

The following build commands failed:
        CompileSwift normal x86_64
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

Is this a problem due to Swift 5.1?

SanjoDeundiak commented 5 years ago

Hi, @bryjch ! It looks like Xcode 11 includes some changes in internal framework structure, so I also have problems building old version. Is there a reason you don't want to try our latest versions? They work fine with latests swift/Xcode

bryjch commented 5 years ago

Hi @SanjoDeundiak , a third party library I'm using has virgil-crypto-x@3.2.2 as a dependency. 😅

SanjoDeundiak commented 5 years ago

@bryjch what library is it?

bryjch commented 5 years ago

It's not an open source library - but the iOS SDK for Clay

SanjoDeundiak commented 5 years ago

@bryjch you can try to download prebuilt binaries and link them without Carthage usage. https://github.com/VirgilSecurity/virgil-sdk-x/releases/tag/5.8.0 https://github.com/VirgilSecurity/virgil-cryptoapi-x/releases/tag/1.0.6 https://github.com/VirgilSecurity/virgil-crypto-x/releases/tag/3.2.3 https://github.com/VirgilSecurity/virgil-crypto-x/tree/3.2.3/VSCCrypto/PrebuiltFramework Theoretically, swift ABI stability should allow you to run your swift 5.1 compiled app with swift 5.0 built frameworks

bryjch commented 5 years ago

@SanjoDeundiak I have given this a shot - although I believe some of the prebuilt binaries are still built with 4.2.1 - I believe with the following:

SanjoDeundiak commented 5 years ago

@bryjch still should work https://docs.swift.org/swift-book/GuidedTour/Compatibility.html

SanjoDeundiak commented 5 years ago

@bryjch also, I wrote a letter to Clay, requesting update of their dependencies to our latests versions

bryjch commented 5 years ago

@bryjch still should work https://docs.swift.org/swift-book/GuidedTour/Compatibility.html

Strange.. I am still encountering an error during build phase:

CopySwiftLibs /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Products/Debug-iphoneos/example-app.app (in target 'example-app' from project 'example-app')
    cd /Users/Bryan/Github/ExampleApp/ios
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk
    builtin-swiftStdLibTool --copy --verbose --sign 48FAE0B31A9F8442D4D72E6B08E312A80D173B6B --scan-executable /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Products/Debug-iphoneos/example-app.app/example-app --scan-folder /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Products/Debug-iphoneos/example-app.app/Frameworks --scan-folder /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Products/Debug-iphoneos/example-app.app/PlugIns --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/CoreBluetooth.framework --scan-folder /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/System/Library/Frameworks/Foundation.framework --scan-folder /Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilCrypto.framework --scan-folder /Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilCryptoApiImpl.framework --scan-folder /Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilCryptoAPI.framework --scan-folder /Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilSDK.framework --scan-folder /Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VSCCrypto.framework --platform iphoneos --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --destination /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Products/Debug-iphoneos/example-app.app/Frameworks --strip-bitcode --strip-bitcode-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip --emit-dependency-info /Users/Bryan/Github/ExampleApp/ios/DerivedData/example-app/Build/Intermediates.noindex/example-app.build/Debug-iphoneos/example-app.build/SwiftStdLibToolInputDependencies.dep

error: The following binaries use incompatible versions of Swift:
/Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilCrypto.framework/VirgilCrypto
/Users/Bryan/Github/ExampleApp/ios/example-app/Clay/Framework/VirgilSDK.framework/VirgilSDK (in target 'example-app' from project 'example-app')

Although it might be due to my project configuration. I will continue to test this.

@bryjch also, I wrote a letter to Clay, requesting update of their dependencies to our latests versions

👌

SanjoDeundiak commented 5 years ago

@bryjch you can try to set whole project to build with swift 4.x, just to make it work for now