Description
Hi,
I'm not able to archive my standalone swift package supporting only iOS platform when I have swift-atomics in the SPM transitive dependencies of my swift package SPM dependencies.
Information
- Package version: 1.0.2
- Platform version: 12.4
- Swift version: swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
Target: x86_64-apple-macosx12.0
Checklist
- If possible, I've reproduced the issue using the
main
branch of this package. - I've searched for existing reports of the same issue.
Steps to Reproduce
- Create a basic standalone swift package like Package.swift.txt
- Try to archive swift package for iOS and iOS Simulator platforms
Expected behavior
Archive my swift package for generic/platform=iOS
and generic/platform=iOS Simulator
destinations in order to generate a .xcframework
Actual behavior
I have a standalone swift package that targets only iOS (v13+).
My swift package has as dependency google-auth-library-swift which has as dependency swift-nio which has as dependency swift-atomics.
When I try to generate the .xcframework from my swift package, I have this error while archiving for iOS and iOS Simulator destinations:
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/SafeRider.xcodeproj -configuration Release -archivePath /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build/SafeRider/iphoneos.xcarchive -destination generic/platform=iOS BUILD_DIR=/Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build SKIP_INSTALL=NO IPHONEOS_DEPLOYMENT_TARGET=13.0 BUILD_LIBRARIES_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO -scheme SafeRider archive
User defaults from command line:
IDEArchivePathOverride = /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build/SafeRider/iphoneos.xcarchive
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
BUILD_DIR = /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build
BUILD_LIBRARIES_FOR_DISTRIBUTION = YES
IPHONEOS_DEPLOYMENT_TARGET = 13.0
SKIP_INSTALL = NO
Ld /Users/sebastienbalard/Library/Developer/Xcode/DerivedData/SafeRider-gryczvykejxqntfoykjzxkaooaoi/Build/Intermediates.noindex/ArchiveIntermediates/SafeRider/InstallationBuildProductsLocation/Library/Frameworks/_AtomicsShims.framework/_AtomicsShims normal (in target '_AtomicsShims' from project 'SafeRider')
cd /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios13.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk -L/Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build/Release-iphoneos -F/Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -filelist /Users/sebastienbalard/Library/Developer/Xcode/DerivedData/SafeRider-gryczvykejxqntfoykjzxkaooaoi/Build/Intermediates.noindex/ArchiveIntermediates/SafeRider/IntermediateBuildFilesPath/SafeRider.build/Release-iphoneos/_AtomicsShims.build/Objects-normal/arm64/_AtomicsShims.LinkFileList -install_name @rpath/_AtomicsShims.framework/_AtomicsShims -Xlinker -rpath -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -dead_strip -Xlinker -object_path_lto -Xlinker /Users/sebastienbalard/Library/Developer/Xcode/DerivedData/SafeRider-gryczvykejxqntfoykjzxkaooaoi/Build/Intermediates.noindex/ArchiveIntermediates/SafeRider/IntermediateBuildFilesPath/SafeRider.build/Release-iphoneos/_AtomicsShims.build/Objects-normal/arm64/_AtomicsShims_lto.o -Xlinker -export_dynamic -fembed-bitcode -Xlinker -bitcode_verify -Xlinker -bitcode_hide_symbols -Xlinker -bitcode_symbol_map -Xlinker /Users/sebastienbalard/Workspace/LibertyRider/saferider-ios/.build/swift-create-xcframework/build/Release-iphoneos -Xlinker -final_output -Xlinker /Library/Frameworks/_AtomicsShims.framework/_AtomicsShims -Xlinker -dependency_info -Xlinker /Users/sebastienbalard/Library/Developer/Xcode/DerivedData/SafeRider-gryczvykejxqntfoykjzxkaooaoi/Build/Intermediates.noindex/ArchiveIntermediates/SafeRider/IntermediateBuildFilesPath/SafeRider.build/Release-iphoneos/_AtomicsShims.build/Objects-normal/arm64/_AtomicsShims_dependency_info.dat -o /Users/sebastienbalard/Library/Developer/Xcode/DerivedData/SafeRider-gryczvykejxqntfoykjzxkaooaoi/Build/Intermediates.noindex/ArchiveIntermediates/SafeRider/InstallationBuildProductsLocation/Library/Frameworks/_AtomicsShims.framework/_AtomicsShims
Undefined symbols for architecture arm64:
"_swift_release_n", referenced from:
__sa_release_n in _AtomicsShims.o
"_swift_retain_n", referenced from:
__sa_retain_n in _AtomicsShims.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My problem seems to be related to https://github.com/apple/swift-atomics#portability-concerns, it is the same part of code which causes a problem but your "manual workaround" fails in my SP "iOS only" case.
$ swift build -Xcc -mcx16 -Xswiftc -DENABLE_DOUBLEWIDE_ATOMICS -c release -v
/usr/bin/xcrun --sdk macosx --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -print-target-info
/usr/bin/xcrun --sdk macosx --find xctest
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -emit-supported-features /var/folders/wk/b_snvw5j52s4fvs94yl9v23m0000gn/T/TemporaryDirectory.fXQsde/dummyInput-1.swift
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -print-target-info
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -emit-supported-features /var/folders/wk/b_snvw5j52s4fvs94yl9v23m0000gn/T/TemporaryDirectory.n1XVva/dummyInput-2.swift
Planning build
/usr/bin/xcrun --sdk macosx --show-sdk-platform-path
/usr/bin/xcrun vtool -show-build /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
/usr/bin/xcrun --sdk macosx --show-sdk-platform-path
/usr/bin/xcrun vtool -show-build /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
/usr/bin/xcrun --sdk iphoneos --show-sdk-platform-path
/usr/bin/xcrun vtool -show-build /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
/usr/bin/xcrun --sdk appletvos --show-sdk-platform-path
/usr/bin/xcrun vtool -show-build /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
/usr/bin/xcrun --sdk watchos --show-sdk-platform-path
/usr/bin/xcrun vtool -show-build /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/Library/Frameworks/XCTest.framework/XCTest
error: the library 'SafeRider' requires macos 10.10, but depends on the product 'OAuth2' which requires macos 10.12; consider changing the library 'SafeRider' to require macos 10.12 or later, or the product 'OAuth2' to require macos 10.10 or earlier.
error: the library 'SafeRider' requires macos 10.10, but depends on the product 'OAuth2' which requires macos 10.12; consider changing the library 'SafeRider' to require macos 10.12 or later, or the product 'OAuth2' to require macos 10.10 or earlier.
Any help would be greatly appreciated.
Thanks.