-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use this package in a static library - Missing required module '_AtomicsShims'
error.
#54
Comments
Thanks for the report! Unfortunately the reproduction steps don't contain enough information to debug this problem -- could you please provide a sample project that exhibits this issue? |
Yup, I'll prepare the sample soon. Thanks! |
👋 Any news regarding this issue? I encountered the same problem when adding some tests to my iOS app. To reproduce the issue:
|
Hello, I have the same issue as @gaetanzanella mentioned above. Xcode 14.0.1 |
I'm also getting this error. Running a Multiplatform app and when I go to test it I'm getting this error "_atomicsshims" on every imported module in the test. The |
I'm also getting this error when trying to archive a Swift package (from the command line using The binary just looks to be absent after the first build step and it fails when trying to |
Hello, I have the same issue too, but different Xcode version Xcode 13.4.1 |
Thanks for sharing the fix @keisukeYamagishi . Unfortuately for me, the error kept repeating for different packages because of |
in case if anyone faces this issue recursively like me for multiple packages, then you can try the approach by duckduckgo/ios. create a static framework in your project and add all Swift Packages to it. Then use that framework in all your targets. For tests, add the framework in your Build Phases like mentioned above by @keisukeYamagishi |
Quick update: @gaetanzanella's sample project has been very helpful in reproducing this. (Thank you!) Unfortunately it's a tooling issue, so the package won't be able to fix it on its own. A proper fix is in the pipeline, but it will need time. @keisukeYamagishi's or @imthath-m's suggestions are currently the best workarounds that I am aware of. |
Getting rid of the C module with something along the lines of #74 would likely also get rid of these issues. However, this will require some Swift compiler & stdlib work, so it will take time. |
In my case, async-http-client was a dependency to a package I'm using, OpenAIKit, which is dependent upon swift-atomics (as @imthath-m mentioned) and adding that to my UI and unit test build phases as @gaetanzanella did allowed my tests to build. |
In static library swift file, on attempt to
import Atomics
I'm gettingMissing required module '_AtomicsShims'
error.This is structure of project in a nutshell:
Atomics
static SPM library as dependency (but NOT as "Link Binary with Libraries" phase)import Atomics
which fails with the above errorThe very same
import Atomics
works well and without errors when it's in a final executable swift files, so problem is specific for static library target only.Note also that StaticLibA deliberately is NOT linked with Atomics - if I did so then step # 1 succeeds but then step # 3 fails with "ld: 465 duplicate symbols for architecture arm64". I believe it's b/c the very same symbols of Atomic lib comes to final executable from both StaticLibA and FrameworkB.
Could you please advice what could be wrong or missing? OR, is it just not supported yet configuration? Thanks!
The text was updated successfully, but these errors were encountered: