I have problem running Xcode previews
in my project. Once I try to start it I get the following error no matter the view I’m trying to preview. Running the app on physical device or simulator works just fine.
linker command failed with exit code 1 (use -v to see invocation)
----------------------------------------
LinkDylibError: Failed to build CustomTextField.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in FBLPromises(PromisesObjC-dummy.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise+All.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise+Always.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise+Any.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise+Async.o)
___llvm_profile_runtime_user in FBLPromises(FBLPromise+Catch.o)
...
(maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have already tried reintegrating pods and removing Framework Search Paths
as -F
option suggested it in above error. This brought no success.
2
Answers
I had a similar issue and solved it by adding -fprofile-instr-generate to Build Settings > Linking > Other Linker Flags
In my case it was some cache conflict.
The same error, with undefined symbols of some struct name from swift package loaded into Xcode project:
It turned out to be two different swift packages with the same name. They’ve even been connected to different projects.
Spent couple of hours figuring. Renamed one of the packages, and error was gone.