apple / swift-numerics

Advanced mathematical types and functions for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`** ARCHIVE FAILED **` due to `_NumericsShims` missing

maximkhatskevich opened this issue · comments

Despite _NumericsShims is NOT intended to be part of public API, attempt to archive any of the publicly exposed modules results into failure.

The command to execute in CLI:

xcodebuild archive -scheme Numerics -destination "generic/platform=iOS" -archivePath "build/ios-device" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

it fails with underlaying error being:

.../Library/Developer/Xcode/DerivedData/swift-numerics-dgyhdelhvghturdxbqtbuzsazzjo/Build/Intermediates.noindex/ArchiveIntermediates/Numerics/IntermediateBuildFilesPath/swift-numerics.build/Release-iphoneos/RealModule.build/Objects-normal/arm64/RealModule.swiftinterface:6:8: error: no such module '_NumericsShims'

Same happens when try to archive in similar fashion any framework (does not matter if it's a Swift Package or created via Xcode framework), WHERE swift-numerics is in the dependencies list.

NOTE: in case of a framework that is built using Xcode, Archive via Xcode GUI works fine with same settings set in Xcode build settings (SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES) - archive works fine. I'd resort to that option, but it does not allow to archive for iOS simulator and I really want to put it in a script for automated execution.

Is it expected/intended behaviour? Any clarifications/suggestions would be much appreciated!

Xcode version 14.3.1

A bit more context. This issue happens when I use https://github.com/apple/swift-openapi-generator (which uses this package as dependency) as development time plugin, but it interferes with the build/archive process anyway. If I switch to manual CLI invocation for the generator - I do not need to mention swift-openapi-generator anywhere in dependencies, and this package is not a dependency anymore, hence it does not block my archive process, which means my problem is solved. But I am curious nonetheless if it is supposed to be this way or is it a bug? What if I want to use this package as dependency in my package and then need to archive a binary version?

It's not totally clear if this is a project issue or an Xcode build issue, or if this is simply a configuration that we can't support yet, but we're taking a look at it.

I agree, it might be Xcode build system issue, indeed. Thank you for looking into it!

Did this ever get resolved or was a workaround found? I just hit this same issue when validating my build for upload to the AppStore. Numerics is a dependency in mlx-swift in my case https://github.com/ml-explore/mlx-swift. I also run into this issue with swift-async-algorithms where the swift-collections was causing the same issue. Here's a link to the issue and a current workaround. apple/swift-collections#364