Hive Hive
Sign in

Error: Could not find or use auto-linked library ‘swiftCompatibility*’: library ‘swiftCompatibility*’ not found

GitHub issue · Open

Metadata
Source
tuist/tuist #5972
Updated
Jun 11, 2026
Domains
Generated projects
Details

What happened?

I use Amplitude SDK, which doesn’t contain any Swift code, only headers. When I try to compile project I catch multiple errors like Could not find or use auto-linked library 'swiftCompatibility*': library 'swiftCompatibility*' not found

How do we reproduce it?

Add the following dependency to Package.swift

.package(url: "https://github.com/amplitude/Amplitude-iOS", from: "8.17.2")

Error log

ld: warning: Could not find or use auto-linked library 'swiftCompatibility50': library 'swiftCompatibility50' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibility51': library 'swiftCompatibility51' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibility56': library 'swiftCompatibility56' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityConcurrency': library 'swiftCompatibilityConcurrency' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements': library 'swiftCompatibilityDynamicReplacements' not found
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityPacks': library 'swiftCompatibilityPacks' not found
ld: Undefined symbols:
__swift_FORCE_LOAD_$_swiftCompatibility50, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibility50_$_AnalyticsConnector in AnalyticsConnector[3](AnalyticsConnector.o)
__swift_FORCE_LOAD_$_swiftCompatibility51, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibility51_$_AnalyticsConnector in AnalyticsConnector[3](AnalyticsConnector.o)
__swift_FORCE_LOAD_$_swiftCompatibility56, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibility56_$_AnalyticsConnector in AnalyticsConnector[3](AnalyticsConnector.o)
__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_AnalyticsConnector in AnalyticsConnector[3](AnalyticsConnector.o)
__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements, referenced from:
__swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements_$_AnalyticsConnector in AnalyticsConnector[3](AnalyticsConnector.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

macOS version

14.3.1

Tuist version

4.3.4

Xcode version

15.2

Comments
I
ilia3546 Mar 4, 2024

Same issue. I found possible solution here: https://github.com/zalando/SwiftMonkey/issues/80#issuecomment-604994492

Create an Empty Swift file using Xcode, such as named Void.swift, and every issue will be solved by Xcode automatically. If you want to know what Xcode has done, submit the code before creating the file, and check the changes after creating the file.

But this solution requires you to fork problem package (in this case Amplitude)

N
NachoSoto Apr 10, 2024

This is still an issue with Tuist 4.9

F
fortmarek Apr 10, 2024

Hey 👋

I can take a look but I can’t reproduce the issue when I add this library to our spm fixture. Would someone be able to attach a zip with the full reproducible project? That would be greatly appreciated 🙌

M
MartinStrambach Jun 20, 2024

I was able to fix the error by defining the framework as dynamic framework in the Package.swift.

#if TUIST
import ProjectDescription
import ProjectDescriptionHelpers
let packageSettings = PackageSettings(
productTypes: [
"LibWhichCausesTheError": .framework,
]
)
#endif
P
pepicrft Jun 25, 2024

My two cents are that is that is related to the issue mentioned here. A framework is linking static binaries whose symbols end up in the public module of the framework. @MartinStrambach could you try setting the build setting GENERATE_MASTER_OBJECT_FILE=YES in the dynamic target that’s closest to LibWhichCausesTheError when navigating the graph upstream?

M
MartinStrambach Jun 25, 2024

Tried it, but it doesn’t help. In my case, it happens due to Nimble dependency in tests. ld: warning: Could not find or use auto-linked library 'swiftCompatibility56': library 'swiftCompatibility56' not found ld: warning: Could not find or use auto-linked library 'swiftCompatibilityConcurrency': library 'swiftCompatibilityConcurrency' not found ld: warning: Could not find or use auto-linked library 'swiftCompatibilityPacks': library 'swiftCompatibilityPacks' not found Undefined symbols for architecture arm64: "__swift_FORCE_LOAD_$_swiftCompatibility56", referenced from: __swift_FORCE_LOAD_$_swiftCompatibility56_$_CwlCatchException in CwlCatchException[3](CwlCatchException.o) __swift_FORCE_LOAD_$_swiftCompatibility56_$_CwlPreconditionTesting in CwlPreconditionTesting[3](CwlBadInstructionException.o) __swift_FORCE_LOAD_$_swiftCompatibility56_$_Nimble in Nimble[3](AdapterProtocols.o) "__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency", referenced from: __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_CwlCatchException in CwlCatchException[3](CwlCatchException.o) __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_CwlPreconditionTesting in CwlPreconditionTesting[3](CwlBadInstructionException.o) __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Nimble in Nimble[3](AdapterProtocols.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

You also said in the dynamic target that's closest to LibWhichCausesTheError when navigating the graph upstream. I don’t think there’s any dynamic target when navigating the graph upstream because my target which links Nimble is just the test target.

P
pepicrft Jun 26, 2024

You also said in the dynamic target that’s closest to LibWhichCausesTheError when navigating the graph upstream. I don’t think there’s any dynamic target when navigating the graph upstream because my target which links Nimble is just the test target.

In that case a target that can link static binaries, the test target in this case. I assume if you setGENERATE_MASTER_OBJECT_FILE=YES, you get the above issue right? Do you know where the symbols swiftCompatibility56… are coming from?

A
Almaz5200 Aug 28, 2024

I am currently facing the same problem, in my case FirebaseCore fails to compile when i put "FirebaseCore": .framework, in package settings. Putting in all the dependencies of FirebaseCore doesn’t seem to make a difference. Did anyone find a workaround?

P
philipbel Sep 12, 2024

I am currently facing the same problem, in my case FirebaseCore fails to compile when i put "FirebaseCore": .framework, in package settings. Putting in all the dependencies of FirebaseCore doesn’t seem to make a difference. Did anyone find a workaround?

For a framework that uses Firebase Auth and GoogleSignIn, keeping FirebaseCore, GoogleSignIn, GTMAppAuth and GTMSessionFetcherCore as .staticFramework in PackageSettings solves the linking problem.

But then I get this type of warnings:

Target 'FirebaseCore' has been linked from target 'A' and target 'FirebaseAuth', it is a static product so may introduce unwanted side effects.

where A is another (internal) framework that uses Firebase thus indirectly FirebaseCore.

P
pwadowski Jan 8, 2026

I have similar issue. I have tried a few workarounds mentioned here but none of them works