# Dynamic library dependecy of a dynamic library is not embedded when building in Xcode, causing "image not found" errors

**URL:** <https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155>\
**Category:** Package Manager\
**Created:** [August 6, 2020, 7:07pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155 "2020-08-06T19:07:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeoNatan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/leonatan/32/7742_2.png) [@LeoNatan](https://forums.swift.org/u/LeoNatan)\
**Post date:** [August 6, 2020, 7:07pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155/1 "2020-08-06T19:07:20Z")

</div>

Hello,

I'm not sure if this is a bug, a known limitation or a user error on my part, but this is reproducing in Xcode 11 and Xcode 12 betas.

I have package A, which is a dynamic framework, and package B, which is dependent on package A.  
When building for simulator in Xcode, the app deceptively launches with debugger attached. However running the app produces the following error:

Dyld Error Message:  
Library not loaded: @rpath/A.framework/A  
Referenced from: /.../Example.app/Example  
Reason: image not found

Looking at the produced app bundle, indeed there is a Frameworks/B.framework, but no Frameworks/B.framework/Frameworks/A.framework, causing the issue.

Any assistance?  
Thanks

---

<div class="post-metadata">

**Author:** ![NeoNacho](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/neonacho/32/1368_2.png) [@NeoNacho](https://forums.swift.org/u/NeoNacho)\
**Post date:** [August 10, 2020, 8:21pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155/2 "2020-08-10T20:21:41Z")

</div>

This does sound like a bug to me.

---

<div class="post-metadata">

**Author:** ![LeoNatan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/leonatan/32/7742_2.png) [@LeoNatan](https://forums.swift.org/u/LeoNatan)\
**Post date:** [August 19, 2020, 6:50pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155/3 "2020-08-19T18:50:02Z")

</div>

Hello,

Where and how should I report this?  
I worked around this by creating a static target as well, and using that, but it's less than optimal for my needs.

Thank you

---

<div class="post-metadata">

**Author:** ![NeoNacho](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/neonacho/32/1368_2.png) [@NeoNacho](https://forums.swift.org/u/NeoNacho)\
**Post date:** [August 24, 2020, 5:05pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155/4 "2020-08-24T17:05:24Z")

</div>

If you're seeing an issue in Xcode, I would always report through [http://feedbackassistant.apple.com](http://feedbackassistant.apple.com)

---

<div class="post-metadata">

**Author:** ![1oo7](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/1oo7/32/17598_2.png) [@1oo7](https://forums.swift.org/u/1oo7)\
**Post date:** [December 29, 2020, 9:07pm UTC](https://forums.swift.org/t/dynamic-library-dependecy-of-a-dynamic-library-is-not-embedded-when-building-in-xcode-causing-image-not-found-errors/39155/5 "2020-12-29T21:07:06Z")

</div>

Been running into this a lot with SwiftUI previews being broken because any non-embedded dynamic library targets that are defined by SPM packages, can't ever be found. This has forced us to have to embed them everywhere. Sent a bug report.

It would be awfully nice if Apple were to prioritize addressing these kinds of issues :D

Update:

I think this is due to the existing version of Carthage, which makes "fat" frameworks that must be "lipo'd" before they can be embedded. Xcode started being more picky about this lately, and the solution is to migrate to XCFrameworks for embedded binaries. Carthage has a new version that makes XCFrameworks, which isn't released quite yet but, we've been testing it, and it does fix our playgrounds and previews. I just wish the error messages we got were more descriptive so we could've realized that this was the problem much earlier!
