# Strange linker error mentioning \`\_swift\_getTypeByMangledNameInContextInMetadataState\`

**URL:** <https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936>\
**Category:** Using Swift\
**Created:** [July 31, 2020, 3:59pm UTC](https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936 "2020-07-31T15:59:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Brown](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michael_brown/32/2480_2.png) [@Michael\_Brown](https://forums.swift.org/u/Michael_Brown)\
**Post date:** [July 31, 2020, 3:59pm UTC](https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936/1 "2020-07-31T15:59:16Z")

</div>

As I've reported in [this issue](https://github.com/stayawayinesctec/stayaway-app/pull/9) when using `$(inherited)` in `LIBRARY_SEARCH_PATHS` I'm getting the following linker error:

```swift
Undefined symbols for architecture x86_64:
  "_swift_getTypeByMangledNameInContextInMetadataState", referenced from:
      ___swift_instantiateConcreteTypeFromMangledNameAbstract in Backend.o
      ___swift_instantiateConcreteTypeFromMangledNameAbstract in DP3TSDK.o
ld: symbol(s) not found for architecture x86_64

```

The only [other](https://developer.apple.com/forums/thread/133503) [places](https://github.com/fastlane/fastlane/issues/16277) where I've seen this issue mentioned have been in relation to React Native projects. The issue above is also in a React Native project.

The workaround is to remove the `$(inherited)` entry and setting all the `LIBRARY_SEARCH_PATHS` manually. However, I fail to understand how that makes a difference.

The only thing that is "removed" from `LIBRARY_SEARCH_PATHS` by doing this is two entries to the swift toolchain:

- `toolchain/usr/lib/swift/iphoneos`
- `toolchain/usr/lib/swift-5.0/iphoneos`

So I'm at a loss to understand what's going on.

The symbol in question is part of the [swift runtime](https://github.com/apple/swift/blob/5141219a69b3b10d5ea90f4ea9a5a81356e2d462/include/swift/Runtime/RuntimeFunctions.def#L1450).

---

<div class="post-metadata">

**Author:** ![Joe\_Groff](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joe_groff/32/1929_2.png) [@Joe\_Groff](https://forums.swift.org/u/Joe_Groff)\
**Post date:** [July 31, 2020, 4:25pm UTC](https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936/2 "2020-07-31T16:25:00Z")

</div>

It sounds like you're trying to link against an older Swift runtime while targeting a newer OS. `swift_getTypeByMangledNameInContextInMetadataState` was added in iOS 13.4 IIRC, and is not in older OS runtimes, nor is it in the Swift 5.0 runtime used for backward deployment to pre-Swift-ABI OSes. You shouldn't need to add the toolchain library paths to LIBRARY\_SEARCH\_PATHS yourself, because Xcode will automatically include those libraries if your minimum deployment target is old enough to need them.

---

<div class="post-metadata">

**Author:** ![Michael\_Brown](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michael_brown/32/2480_2.png) [@Michael\_Brown](https://forums.swift.org/u/Michael_Brown)\
**Post date:** [July 31, 2020, 8:55pm UTC](https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936/3 "2020-07-31T20:55:15Z")

</div>

> It sounds like you're trying to link against an older Swift runtime while targeting a newer OS.

It turns out that at the Project level, not the Target level, someone had defined:

```swift
LIBRARY_SEARCH_PATHS = (
					"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
					"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
					"\"$(inherited)\"",
				);

```

🤦‍♂️

After removing that, and making sure everything is targeting iOS 13.5, the error has gone away. Thanks for your help Joe 👍

---

<div class="post-metadata">

**Author:** ![aguilarpgc](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/aguilarpgc/32/18224_2.png) [@aguilarpgc](https://forums.swift.org/u/aguilarpgc)\
**Post date:** [September 29, 2025, 9:24pm UTC](https://forums.swift.org/t/strange-linker-error-mentioning-swift-gettypebymanglednameincontextinmetadatastate/38936/4 "2025-09-29T21:24:27Z")

</div>

Yes, same error, I change it to LIBRARY\_SEARCH\_PATHS = "$(SDKROOT)/usr/lib/swift"
