# SPM dynamic library producing 2 instances for some packages in Xcode

**URL:** <https://forums.swift.org/t/spm-dynamic-library-producing-2-instances-for-some-packages-in-xcode/70047>\
**Category:** Using Swift\
**Tags:** spm, packagemanager\
**Created:** [February 14, 2024, 11:31pm UTC](https://forums.swift.org/t/spm-dynamic-library-producing-2-instances-for-some-packages-in-xcode/70047 "2024-02-14T23:31:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mark/32/3009_2.png) [@mark](https://forums.swift.org/u/mark)\
**Post date:** [February 14, 2024, 11:31pm UTC](https://forums.swift.org/t/spm-dynamic-library-producing-2-instances-for-some-packages-in-xcode/70047/1 "2024-02-14T23:31:02Z")

</div>

I'm trying to link all of my SPM dependencies as dynamic libraries. However, at runtime I'm getting symbol collision warnings.

> Class TtC9FrameworkA43Class is implemented in both ../DerivedData/MyApp-rynwnsmwl/Build/Products/Debug-iphonesimulator/PackageFrameworks/FrameworkA\_1550442A05D4B\_PackageProduct.framework/FrameworkA\_1550442A05D4B\_PackageProduct (0x14855a178) and  
> ../DerivedData/MyApp-rynwnsmwl/Build/Products/Debug-iphonesimulator/PackageFrameworks/FrameworkA-Dynamic.framework/FrameworkA-Dynamic (0x113abe178). One of the two will be used. Which one is undefined.

If I look in ../DerivedData/MyApp-rynwnsmwl/Build/Products/Debug-iphonesimulator/PackageFrameworks/ then I'm seeing 2 instances of the same framework that should only exist as 1 dynamic library, but not for all of my libraries:

```swift
FrameworkA_1550442A05D4B_PackageProduct.framework
FrameworkA-Dynamic.framework
FrameworkB-Dynamic.framework
FrameworkC-Dynamic.framework

```

What's going on here? Is this a remnant of some old build steps and I should just clear my cache and try again? Or do I have something misconfigured?

I'd really like to understand what the generated `Framework_abcd_PacakageProduct.framewrok` _is_.

The file type is a `Mach-O 64-bit dynamically linked shared library arm64` (from the `file` command), so from my point of view it looks like the build system is choking on producing a single dynamic framework and producing 2. Tips and education welcome!

---

<div class="post-metadata">

**Author:** ![mickeyl](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mickeyl/32/12258_2.png) [@mickeyl](https://forums.swift.org/u/mickeyl)\
**Post date:** [December 28, 2024, 3:00pm UTC](https://forums.swift.org/t/spm-dynamic-library-producing-2-instances-for-some-packages-in-xcode/70047/2 "2024-12-28T15:00:20Z")

</div>

Did you figure it out since then? I'm trying to go dynamic in order to prevent a complex situation with duplicated and missing symbols when combining packages that produce several libraries with certain interdependencies, but that triggers a whole new class of linker failures.

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mark/32/3009_2.png) [@mark](https://forums.swift.org/u/mark)\
**Post date:** [December 28, 2024, 8:46pm UTC](https://forums.swift.org/t/spm-dynamic-library-producing-2-instances-for-some-packages-in-xcode/70047/3 "2024-12-28T20:46:10Z")

</div>

I'm afraid not. Ultimately I had to convert all of our dependencies to SPM, omit any explicit usage of `dynamic`, and let Xcode link things how it prefers.
