Command [...]/clang failed with exit code 1 - ios

I have a serious problem with one of my ios application because i can't compile it anymore. I think its due to a mislinked file (see the error at the end).
The whole story started when i wasn't able to add a file to a target. I then couldn't build because of this error, see: Duplicate interface declaration for class 'Foo'. Xcode miracously copied my sources within itself to a subfolder with the projectname. I deleted as suggested but i know keep running into the error pasted at the bottom.
In effect it is due to clang looking for a file a very deeeeeeeply in itself nested folder which of course doesn't exists. What did xcode do here and how can i get it working again?
This is the last part of the error
clang: error: no such file or directory: '/Users/Shared/projects/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/samefolder/AppDelegate.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Okay i found it! I knew there had to be a list of files it tries to compile somewhere. I finally found it under the targets build phases. There you have entries for "compile sources" and "copy bundle resources" which both got cluttered in my case. I corrected those file lists and it finally worked again.

Related

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.

I Deleted A File, And Xcode Is Giving A Clang Error

I imported a file (tlb.c), but then I (intentionally) deleted it. Now when I run the project, Xcode is giving a clang error and says that it is because it cannot find "tlb.c". I did not edit any of the original files to reference it, so I don't see any reason why it would throw this error.
I deleted it because I realized that I did not download the .h file that went with it.
I have cleaned the project, and completely restarted Xcode multiple times.
Here is the error it gives me:
clang: error: no such file or directory: '/Users/Tom/Desktop/Test64iOS Resource/Test64iOS/tlb.c'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Did you remove the file from your project as well as delete it from disk? If you failed to remove if from your project you'll still see it project navigator except the font will be red.
If that's not your problem, select your project root in Project Navigator and then select "build phases." There's a "Compile Sources" section. See if the file is listed there and remove it.
Just ran into this same issue on Xcode 9.1,
I checked out the "Compile Sources" section but the file wasn't listed. I cleaned the project multiple times, tried searching my computer for the file to restore it (it wasn't anywhere to be found).
Finally, I just exited Xcode and came back. Error gone.

Any ideas why I'm getting these errors in xcode?

I have the following errors in xcode below, any ideas what's causing these?
arm-apple-darwin10-llvm-g++-4.2: /Users/<foldername>/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/libbtexternal.a: No such file or directory
arm-apple-darwin10-llvm-g++-4.2: /Users/<foldername>/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/libbtexternal.a: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/1x/_btz9s41381cdzz41ty0r5fm0000gn/T//cc8KPWhc.out
error: linking step of external dylib build failed, probably due to missing framework or library references - check the contents of the btexternal.ios file
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
Please check that are you having the file libbtexternal.a. If not then add it to your project after this go to the project and there is option Build phases. You find here four rows in which you have to select Link Binary with Libraries and add your .a file to the frameworks you are seeing here. I think it will work, If not then tell me.
Hope this helps.

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. : - )

clang: error: linker command failed with exit code 1, only when testing on device

I was just about to test my app on a device when I ran into this problem, I'm getting this Linker Error.
I've already checked all my compile sources and Build Phases, but there's no sign of my importing things twice.
ld: duplicate symbol _calculateNextSearchPage in /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) and /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This only happens when testing on a device, not in the simulator.
Alright guys I had the same problem. Seems like I fixed it.
I am using cocapods therefor the described standard procedure can not be properly executed.
Steps to do to properly add FastPDFKit with Cocoapods.
Download FastPDFKit
In your project Add Files to "Your Project"
go to FastPDFKit folder you just have downloaded
locate 1 folder and 1 project file. Press and hold Command key and add these in to your project
FastPdfKit.xcodeproj
FastPdfKit.embeddedframework
(Note: FastPdfKit.embeddedframework is the actual Framework and you
might want to open FastPdfKit.xcodeproj standalone before adding it
to your project, delete FastPdfKit.embeddedframework folder from
your disk and Build FastPdfKit target in the project. You should see
newly created FastPdfKit.embeddedframework folder)
Go to your Project Settings > Your target > Build Phases > Link Binary with Libraries
Make sure FastPdfKit.framework is there.
If not, drag it from the project and put it there.
Clean the project, delete derived data
Add #import <FastPdfKit/FastPdfKit.h> where you need it and you are good to go.
Here is how my Link Binary with Libraries look like
Please let me know if you have any troubles I might've missed something.
Try to delete duplicate files/images which are in target-> Build phase -> Compile files, Copy bundle resources

Resources