Build failing? Apple Mach-o linker error? - ios

My app was working fine until I started playing with archiving. Im not getting any compiler warnings or errors, but when I run the app, the build fails, saying
Apple Mach-o linker error: linker command failed with exit code 1 (use -v to see invocation)
I commented out all the archiving code I was playing with, but the build continues to fail, and I have no idea why. Again theres no warning/errors until I build, so I don't know what happened or where its coming from?
Can anyone tell me what this means and what I need to do to fix it?
EDIT:
Here is what the issue navigator says:
/Users/MikeGordon/Library/Developer/Xcode/DerivedData/HW1ARC-egqtecfuosawiadlwgfulhqjdhtr/Build/Intermediates/HW1ARC.build/Debug-iphonesimulator/HW1ARC.build/Objects-normal/i386/Assignment.o
ld: 18 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 18 duplicate symbols for architecture i386
EDIT: Here are some screen shots
http://imgur.com/3zd53ZP
http://imgur.com/tqhCa1g
http://imgur.com/Ena17FF

Check that there are no duplicates under Targets/Compiled sources. If there are duplicates, delete them.

I don't know how, but many of my .m/.h files were duplicated and under other folders. To remedy the problem, I deleted one copy of the file from one of the folders. The other duplicate file, then turned red. So, then I deleted the second copy of the file. At that point, I had no instances of either file in xCode. Then I went to my Trash, sorted by Date Added, highlighted the files that were just placed in Trash, right clicked and selected Put Back. The I went to File> Add Files to ("myProject") and selected the files I just restored. Everything was back to normal at that point. I ran the simulator and it all worked great!
Peculiarly, the Trash only had one instance of the file, even though it was referenced twice in the Project Navigator.

Related

Xcode 9. linker command failed with exit code 1 (use -v to see invocation)

I have been stuck on this error for a long time. I have reviewed the trend on this topic and tried to open the project in .xcworkspace and still no luck.
ld: file not found: /Users/xxxx/Library/Developer/Xcode/DerivedData/Txxx-butxfnudrokzxihekswcjwgejvzd/Build/Products/Debug-iphoneos/xxxxx.app/xxxxxx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
what else can could i do to fix this?
update
I clean and deleted derived data folder and then rebuild the workspace and this is the error i got
import XCTest
import Firebase
#testable import Takehome
Takehome/TakehomeTests/TakehomeTests.swift:11:18: No such module 'Takehome'
Delete derived data from Xcode (preferences>location) and then clean. Also restart the whole machine. Oh yes, and delete from simulator / device.
If it is a small project, just recreate and write again. (simple one)
Takehome folder is needed for the project, it can not find that folder and files in it. Delete files with red color names in the workspace if exists, then add them manually.
The error is like file linking problem, if you use libraries, add one by one, build one by one.

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.

directory not found for option '-F/Applications/Xcode.app/../Developer/Library/Frameworks' ld: file not found:

I'm not sure why but all the sudden my project fails to build and shows:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/Developer/Library/Frameworks'
ld: file not found: /Users/../Library/Developer/Xcode/DerivedData/inline-ios-axberuiwgueuitfzxttaoekgigob/Build/Products/Debug-iphonesimulator/myapp-ios.app/my-app
clang: error: linker command failed with exit code 1 (use -v to see invocation)
how can I investigate this?
I recently deleted a file from the tests folder
and the bundle id was changed a day ago
Update
I saw an answer in another thread in SO, saying to delete anything under framework search path.
but mine was empty already
Make sure to check all of your targets. My main app target had the Framework Search Path already empty and still had this issue as well.
I found a Github issue for a project having this issue and they solved it by removing a test (or test file maybe). I checked my test target and found that it did have the {SDK-ROOT} path in there still. I deleted it, and the warning went away.

Linker error while using KIF on xcode6

When i'm trying to use KIF, I get this linker error. Anybody know what is it?
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Framework'
ld: file not found: -fobjc-arc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks for any idea.
I had this happen many times to me. Every time it was because I missed a step in the installation of KIF. Go back to the installation instructions and ensure you set all the configurations correctly. Pay special attention to the instructions for header paths. I am on my phone right now or else I would be able to give you the exact settings. Go double check the instructions. If your settings are correct reply here with that info and we can try to figure it out together. First though make sure these things are correct. Once you do, clean your project (Cmd-shift-K), close project, delete your derived data (preferably through Terminal) and then try to build again).

linker command failed in Xcode

I was building an app, but later on I quickly changed something(a value in char variable) and tried to load again, now I am getting this error
ld: 9 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have undone what I have done, but still I am getting this error.
I have tried to delete build folder, it did not work... I also performed clean and build but still it cannot build...
You have to check the files included in the build. Quite possibly there are some duplicate implementation (or perhaps header?) files included.
Navigate to {Project} > {Target} > Build Phases.
Check the Compile Sources build phase for duplicates.
Remove all duplicate files.
Also make sure no duplicate libraries are included in the project. You may check this in the Link Binary With Library phase. Basically same story as above, but for libraries.
Finally make sure to clean the project before building (Product > Clean).
My error message was a little different - duplicate symbols ... in ClassImplmentationFile.m
I didn't have any of the duplicates, as described above, but I noticed that the .m files that were listed in the error message, were in Build Phases/ Compile Sources.
I removed them from there and the thing ran fine.
I didn't put them in there. I guess Xcode auto-screwed-up my project at some point. : - )

Resources