soto-core: Cross compilation for amazonlinux fails on macOS
Describe the bug I am including aws-sdk-swift aversion 5.0.0-alpha.6 as a dependency to my package. While compiling from Xcode - it works fine. While cross-compiling using below command
swift build --destination /usr/local..../swift-5.3-amazonlinux2.xtoolchain/destination.json
build fails on importing Crypto.
I think that it might be caused by os directive used below as os() for cross-compilation will return value not by the target platform but for the one used for building. Therefore it returns false on macOS, so useSwiftCrypto = false and dependency below is not added at the end.
// switch for whether to use swift crypto. Swift crypto requires macOS10.15 or iOS13.I'd rather not pass this requirement on
#if os(Linux)
let useSwiftCrypto = true
#else
let useSwiftCrypto = false
#endif
// Use Swift cypto on Linux.
if useSwiftCrypto {
package.dependencies.append(.package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"))
package.targets.first { $0.name == "AWSCrypto" }?.dependencies.append(.product(name: "Crypto", package: "swift-crypto"))
}
To Reproduce Steps to reproduce the behavior:
- Include as a package dependency aws-sdk-swift 5.0.0-alpha.6
- Build the package using the command above
Actual behavior Build fails on importing Crypto
Expected behavior Build works
Setup (please complete the following information):
- OS: macOS, Xcode 12 beta 6
- Version of aws-sdk-swift 5.0.0-alpha.6
- Authentication mechanism: n/a
Additional context n/a
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 25 (13 by maintainers)
@adam-fowler Sure, I will check it today or at the latest tomorrow as I should get my MacBook back from service today.