Xcode 7 simulator error "duplicate symbols for architecture x86_64" - ios

My development environment with Xcode 7.2.1, CocoaPods 1.0.0 and GoogleMaps 1.13.2
I can build code successful to generate a XXX.ipa file and install in my iPhone 6 Plus to work correctly.
But when I run Xcode simulator by item "iPhone 6" or "iPhone 6 Plus" always get the information as below
"xxxx duplicate symbols for architecture x86_64" "linker command
failed with exit code 1 (use -v to see invocation)"
I use the following solutions still can't fix it
Build Options -> Enable Bitcode -> set "No"
Remove -ObjC from Other Linker Flags
project Targer -> Build phases -> compile sources, ckeck no duplicate files
Make sure I haven't #imported a .m file
I am wondering if there are any other method to solve this, help would be appreciated thanks.

This error generally occurs when you have linked any library or file twice.
In the error desciption, the name of the duplicated file will be listed, you can search and and make sure you don't have duplicates.
If you find duplicates, remove reference to one of them to play safe

I have faced similar kind of issue.
In my application I have run my code and created ipa before two day. And today when I am trying to run same code without any changes I am getting:
ld: 102 duplicate symbols for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
The solution for this duplication Linker error can be solved by Remove all of your classes from compile sources, then click the + button and search for the term '.m'. Highlight every class, then click add. Build and run again.

This problem can also be occurred in case you import ".m" file instead of ".h" by mistake. I know it may be seemed as a stupid advise but this is what I had done in my case.

I resolved this issue by removing the -all_load flag in the Build Settings-> Other Linker flags.

Related

clang: error: linker command failed with exit code 1 (use -v to see invocation) Bitcode Fix NOT Working

I'm trying to move an Xcode app from a MBP to an iMac. I've copied all the folders and files needed but keep getting to following error on build:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After Googling around a bit the most common fix for this is to set Bitcode to no. I've done this but it doesn't make a difference. I've also tried quitting Xcode emptying the DerivedData folder and restarting.
Below is the error in Full:
Here is a list of my linked libraries:
It sounds a lot like the error is true - have you definitely got your libWikitude framework in a referenced path?
Go to XCode, Build Settings, find 'Framework Search Paths' under Search Paths, and make sure the folder of your libWikitude is correct.
Perhaps it's hardcoded and now the path has changed?
After a few headaches with this I decided to simply remove all references to the Wikitude lib as it was not being used by the app.
This immediately solved the issue. Thanks for those who answered.

xcode - linker command failed with exit code 1 - build settings

I'm using Xcode 7 and can't build successfully because of the following error:
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The error above is associated with the following file:
Ld /Users/(USERNAME)/Library/Developer/Xcode/DerivedData/(PRODUCT NAME)-(RANDOM STRING)/Build/Intermediates/(PRODUCT NAME).build/USDev-iphonesimulator/(COMPANY NAME).build/Objects-normal/i386/(COMPANY NAME) normal i386
cd /Users/(USERNAME)/Developer/(PRODUCT NAME)-ios
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
This error started occurring after merging multiple branches of code (each branch worked properly prior to the merge). Can somebody tell me what is causing this error and how I can get past this problem?
----- UPDATE -----
Spending more time on this problem, I've noticed that the merged code works on my coworkers computers so the issue must be local. Looking at the "Build Settings" (Go to the workspace file -> Build Settings (middle pane)), I noticed that the settings under the "Linking" section of "Build Settings is different between Xcode on my machine compared to my coworkers. Not sure if this is the root issue, but does anybody know what I need to do in order to set the Linking settings?
There was an extra framework that I needed to remove:
Go to your .xcworkspace file
Click on the "General" tab in the Editor pane
Scroll down to the "Linked Framework and Libraries" section
Find the framework/library that the compiler is complaining about (in my case it was called "framework.Pods"
This problem stumped me for days...

Debug scheme won't build - Apple Mach-O Linker Error. Linker command failed with exit code 1

ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get this error way too often and it's driving me (and the team nuts). The project was building just fine last week and I did nothing to the project in the mean time, just opened it yesterday and now I'm getting this error when building using the Debug scheme only; Adhoc builds fine. I'm running the latest Yosemite, Xcode 6.1 (but this has plagued me for many months anyway). My instructions to resolve it work occasionally, like black magic:
Clean
Restart Xcode
Delete derived data (check preferences/locations)
Pod update
Open project using the Workspace file
Delete the workspace file and run pod install
But unfortunately this time it's just not working! I've done this process over and over. I'm so frustrated with this PoS Xcode. Next step would be to re-download the project from Git, but there must be a better way! I have gone through a number of other stack overflow posts but found nothing to help (nor anything very recent). Thanks!
The same error drove me nuts for two days. I fixed through the following :
Project > Targets > Build Settings > Packaging > Product Name - Check if the product name has changed.
Also try setting the Build Active Architecture to NO in your project..
Project/Pods > Build Settings > Architectures > Build Active Architecture Only
Just delete the build folder of your project and rebuild it again. Always works for me!

ld: building for iOS Simulator, but linking against dylib?

I'm having a issue compiling my app for Simulator. In the device runs perfectly but once I tried it to compile in simulator I get the following error:
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked before posting this question, but the answers I found in stackoverflow, like to run this,
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct‌oolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
or
The problem was that Xcode 5 replaces gcc with clang and adds in a "-triple" option that specifies OSX as the target. If you pass "-miphoneos-version-min=7.0" on both gcc command lines it works. You can see the clang command line if you pass "--verbose" to gcc. It's also necessary to add to the PATH for Xcode 5 so that cmake can find the necessary tools: export PATH=/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xct‌​oolchain/usr/bin:/Applications/Xcode5-DP6.app/Contents/Developer/usr/bin:$PATH None of this is official.. but works for me so far.
I dont really understand how to to do this. Any help, please?
Check Build Settings for your test target. This values should look similar:
If you have any escaped symbol, consider to fix it. I had here : \". I just removed them
Also notice: order is important!
P.S. from GraehamF It's always a good thing to Build -> Clean and restart Xcode, so the changes to take affect
When I faced this error with an XCode project, I open the file ???.xcodeproj (in a SubLime Text editor) and removed the below lines. The warning will no longer be there!
LIBRARY_SEARCH_PATHS = (
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
);

Having issue with AR on iOS 7 and Xcode 5

I developed a project with ninevehGL engine and vuforia sdk , every thing worked fine on xcode 4 , and iOS 6 , but today I compile my project and got two different strange errors :
ld: warning: directory not found for option '-L/Users/MK/Documents/Xcode project /CarShowcase/Qualcomm'
ld: library not found for -lQCAR
clang: error: linker command failed with exit code 1 (use -v to see invocation)
or
Lexical or preprocessor issue 'QCAR/Tool.h' file not found
I checked header path and everything is OK ! but is there any solution to fix these issues ?
Lover,
Go to-> Target-> Build Phases -> Link Binary with Libraries,
Here you will see, your missing libraries in red colour, indicating the libraries not found, just remove these. & add gain using "+" button -> Add Other, and then locate the libraries. Hope this will help.

Resources