Skip to content

Cannot use this package in a static library - Missing required module '_AtomicsShims' error. #54

@serges147

Description

@serges147

In static library swift file, on attempt to import Atomics I'm getting Missing required module '_AtomicsShims' error.

This is structure of project in a nutshell:

  1. StaticLibA // has Atomics static SPM library as dependency (but NOT as "Link Binary with Libraries" phase)
  • foo.swift // needs atomic stuff, so does import Atomics which fails with the above error
  1. FrameworkB // links with StaticLibA
  • has some swift files which depend on StaticLibA types
  1. ExecutableC // links with StaticLibA, FrameworkB & Atomics
  • uses both the static lib and dynamic framework

The 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions