`swift test` produces "symbol(s) not found for architecture x86_64" linker error - swift

I'm currently trying to add support for the Swift Package Manager to a side-project I've been working on and am running into trouble when trying to run the unit tests I have for the project.
When running them within XCode, I have no problem building and running all of my unit tests; however, when I try to run my tests with the package manager using swift test, I get the following linker error:
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

I ended up figuring out a solution that I'm happy with. I've added a link to the PR here that fixed things, but the general solution was to create a new shared framework target that both my executable and test targets linked to!

Related

Xcode test build fails

Every time I run cmd + u I get this error:
If I run cmd + b the build is successful.
I tried to install for testing same pods as debug build but it seems that is not the problem. Also clean derived data also does not work.
Please, if you have any clue share it. Also feel free for asking about more information.
Edited:
ld: warning: Could not find or use auto-linked framework 'Lottie'
ld: warning: Could not find or use auto-linked framework 'Airship'
Undefined symbols for architecture arm64
Thanks
In podfile, after stopping using inherit from test target, and set this one to use Lottie and Airship directly, it works properly. In this way I can use this frameworks with my tests.

ld: framework not found Lightning

I'm trying to add the lightning framework to my Xcode project, and the project is not building with an error:
ld: framework not found Lightning
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I'm working in the .xcworkspace, and I've tried to do use the commands pod deintegrate, pod install. I've also tried deleting the framework from Linked Frameworks and Libraries and readding but nothing is working
Try basic solutions like clean Xcode (press Cmd+Shift+K ), close Xcode and reopen If doen't help remove framework , do pod install and add again your framework and pod install ...

xcode7: hit linker command failed with exit code 1 under

I hit below error when build app on real device(ios9.0) use xcode7 beta:
ld: library not found for -lPods...... clang: error: linker command
failed with exit code 1 (use -v to see invocation)
I tried to
change the config "Enable Bitcode" to "NO".
hardcode Framework path under build setting tab
but it didn't help.
check this framework if existed in your project folder,you can right
click on this framework in Xcode.
if existed, delete this framework under Frameworks in Xcode and then copy this framework into Xcode again for re-reference.

Cocoapods 0.35 is failing build

I'm working on a Swift app in Xcode 6. Everything was working okay until I decided to install cocoa pods and a pod. When I try to run it on the simulator, I get the following error:
ld: 91 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Before the error, there is a listing of all those duplicate symbols.
First few lines in error message:
Ld /<...>/Library/Developer/Xcode/DerivedData/<...>-gydnbbvfswpkkodlsuxdkpzkklzb/Build/Products/Debug-iphonesimulator/<...>.app/<...> normal x86_64
cd "/<...>/Documents/iOS Apps/<...>/<...>"
export IPHONEOS_DEPLOYMENT_TARGET=8.1
I even tried uninstalling the pod, but the error persists. I'm completely stuck – any help is much appreciated. Thanks!
Maybe you should update your CocoaPods to 0.36 or a later version, and add use_frameworks! to your Podfile. See this: CocoaPods 0.36 - Framework and Swift Support
Maybe :
You have put the same class implementation into two different files;
You actually have just one implementation of this class, however you are also linking in your project a framework or library containing a class whose name is exactly the same of yours.

library not found for -lstdc++ in Xcode

I am using the openCV2.framework in my application. It works fine in the simulator, but is not compiling for iOS devices. It get the following error
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I added other linking flag also...
Try using libc++ instead of stdc++. (lib)std++ went GPLv3, so Apple is pushing libc/c++ instead.
I am answer my own question. I solved this problem by add the go to Target -> BuildSettings ->search Path -> library Searchpath
give the correct path of added dynamic library Path .
Now it will work