Apple LLVM 6.0 Error: clang failed with exit code -1 - ios

I created my app on my MacBook Air and kept working with it there which was fine. Then I started working with a colleague who used another Mac (of course). Anyway, we share our Xcode project via Dropbox (we are just switching to BitBucket, don't worry ;) ), when he tried to open the project on his Mac there was a Apple LLVM 6.0 Error with the following error while on my computer the same project runs perfectly:
clang: error: no such file or directory: '/Users/linus/Dropbox/Apps/My App/Projekt/My App/SlideMenu/SlideMenu-Prefix.pch'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
The last lines of the error seem most important to me which is why I listed them here.
I do know this question was asked several times now but there was never a useful answer which worked for me. I tried to disable the Foundation Assertions as it said in another answer on this topic but that did not work. Also I restarted & even reinstalled Xcode and all files are existing, none should be missing.
I am running Xcode 6.0.1 and Mac OS X 10.10. I hope someone can answer this, I'm kind of desperate now...

Hey I just ran into the same problem. Basically I deleted my tests target. I found this:
Errors When Compiling iOS 8, Xcode 6.0.1
Which basically says that:
Click on the name of your project on the list of files/folders on the
left in Xcode (at the very top of the list). Look at the "Targets"
section on the left-hand side of the window to the right. Likely,
there's two listed with the second being a "test" item. Right-click on
that item and select "delete". Then try to run the project again. See
screenshot below for a visual cue.
And a picture to help you out:
Hope this helps!
EDIT: Also in the tests target, I actually found that I didn't necessarily need to delete it, there was a broken path, just fixing it makes it all work again.

Make new file: ⌘cmd+N
iOS/Mac > Other > PCH File > YourProject-Prefix.pch.
Project > Build Settings > Search: "Prefix Header".
Under "Apple LLVM 6.0" you will get the Prefix Header key
Type in: "YourProjectName/YourProject-Prefix.pch"
Clean project: ⌘cmd+⇧shift+K
Build project: ⌘cmd+B

Solved this by going to my project settings and changing the deployment target. The deployment target was originally at 7.0. When i changed it from iOS 8.0 -> 9.1 it works fine and there is no error.
Hope that helps :)

You do not need to delete the overall build settings. Just change the Library Search Paths, here are the steps:
Click on your project name (very top of the navigator)
Click on your project target
Click the tab Build Settings
Search for LIBRARY_SEARCH_PATHS
Change its value to $(inherited) flag.
Here you go!
Or else you can always remove the build setting at all! Cheers!

One of the simple things I did I went into "Build Options" and changed the property for Enable Bitcode from yes to no
This fixed my issue.
Screenshot of Settings

clang can't locate your precompiled header file. Have you checked whether there is a file named SlideMenu-Prefix.pch in /Users/linus/Dropbox/Apps/My App/Projekt/My App/ ? The path to the precompiled header file is specified by the "Prefix Header" build setting for your target.

Try,
In Xcode project settings,
Targets-> Tests section-> Build Settings->Linking remove all linkig
OR Remove Tests Section as a whole.
Build again and Its done!!

Related

iOS app fails to create archive in Xcode but builds fine

This completely baffles me. I have a project that used to archive just fine, but after I updated Xcode it is now failing to create an archive for it. The failure is from an included project source file not finding a header. Again, this is one that built just fine before and now failing. Also, it builds and runs just fine, just failing on archive. This is the version of Xcode I am using: Version 7.1 (7B91b).
Has anyone encountered similar issues?
The error is basically:
'Header.h' file not found
Again, that file exists. Its there. The project runs and builds just fine. It only fails to find it during 'Archive'.
You said that the failure is from an included source file. I have seen some people with a similar problem when they imported the Cordova library. Some of them solved it with the solution given here.
Add this line to your Build Settings -> Header Search Paths:
"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"
Don't replace the existing line that looks similar, that is still needed to be backwards compatible with Xcode 7 and Xcode 6.4.
Good luck!
Adding this to my "Header Search Paths" fixed the problem.
"$(BUILD_ROOT)/../IntermediateBuildFilesPath/Headers"
Apparently certain folders where the headers reside are not built during the "Archive" process.
Maybe cleaning and building your project fixes the problem?
You need to select a real device as the target, otherwise archiving doesn't work. But can you build release builds at all? (For example, does "build for profiling" work? )
You need to select a real device as the target, otherwise archiving doesn't work. But can you build release builds at all? (For example, does "build for profiling" work? ) For example, you might have a line
#ifdef DEBUG
#include "MyHeader.h"
#endif
and the header won't be included in a release build. Easily done.

Warning message in existing project after upgrade to Xcode7

I have just recently upgraded to Xcode 7 and now I get this warning:
ld: warning: directory not found for option '-F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
I researched different forums and everybody with similar issue recommends to remove paths from build settings but I can't find any paths there resembling iPhone simulators....
I had the same issue, here are the steps that worked for me
open your project
got to TARGETS
select youAppNameTests
select Build Settings
Framework Search Paths
Delete every thing from Debug and Release fields
clean project
Hope it will work for you too
The problem has to do with the test target. Delete your test target. (Copy the code out to some other program if there is any.) Quit Xcode and clean out the Derived Data folder. Now open your project again, and the problem will be gone. If necessary, now make a new test target.

XCTest build errors for test target Xcode 5:

I have set up an XCode 5 iOS 7 project for unit tests.
Of course, setting up the unit tests are taking me so long that I'm trying to keep the faith that it's worth it. Struggling for hours over this error:
ld: building for iOS Simulator, but linking against dylib built for MacOSX file
'/Applications/Xcode5-DP5.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest'
for architecture i386
Any ideas on how to solve?
Check your Framework Search Paths in your test target settings. These can be corrupted when adding the XCTest Framework.
Adding XCTest to one of my projects prepended a "/" to the paths causing them to not find the correct version.
None of the above answers worked for me. I did find an answer here in a comment left by Tim Macfarlane.
For linker errors looking for a class in your app...
set the “Symbols Hidden by Default” build setting to “NO” in your app
target. This makes all your app classes available to your test target
automatically...
So, that means:
Project Navigator > Select your project
Targets > Select your App (not Tests)
Build Settings > Search for "Symbols Hidden By Default"
"Symbols Hidden By Default" > Change it from "YES" to "NO"
I had the same issue; the problem (for me, at least) was that the FRAMEWORKS_SEARCH_PATHS build setting listed the SDK frameworks folder after the main developer frameworks folder.
The frameworks included with Xcode have three separate builds: one for OS X, one for iOS (device), and a third for the iOS Simulator. The OS X build is in the main developer folder, with the other two being under their respective platform folders. The rub here is that if you don't specify to search the SDK folders first (which are within the platform folders), Xcode (or more correctly, the linker) will find the OS X build first and produce the error you see.
The solution is simple, put:
FRAMEWORK_SEARCH_PATHS = $(SDKROOT)/Developer/Library/Frameworks $(inherited)
in your build settings. If you're putting build settings in the project file (I don't recommend it, but that's another question for another day), it's just named "Framework search paths."
NOTE: Sometimes Xcode's a little slow to catch on; you'll probably need to delete your build folder (better than just a clean) for this to take effect.
Have the same problem after converting tests from SenTestCase to XCTestCase. Reverting framework dirs fixed issue:
"$(SDKROOT)/Developer/Library/Frameworks" (non-recursive)
"$(DEVELOPER_LIBRARY_DIR)/Frameworks" (non-recursive)
So, for me, what I was missing after trying everything else in this post, was:
Other Linker Flags:
-framework XCTest
I'm currently using Xcode 6.0 (with the iOS 8 SDK) so I'm surprised that the "Edit > Refactor > Convert to XCTest..." option doesn't add this automatically.
I was facing problem while adding sentestingkit framework in xcode 5 . These settings worked for resolving linker problem.
I had this problem upon adding another file for tests.
If you do this with (CMD + N) be sure to only target
the Test Bundle (ie. 'AppNameTests').
I guess only these .xctest bundles have access to the
XCTest Framework.
I had the same issue after renaming my Target name and moving things around. It turned out that my tests were part of my Main Target. Make sure that you all your test files belong only to your test target.
Just select a .m file, make sure you have the right pane open.
I had the same problem when tried to build XCTTest-based unit tests with pre-7.0 SDK. When I chose 7.0 as my Base SDK then that kind of link error disappeared.
Had a the same issue but ended up with a slightly different solution.
select XCTest.framework and make sure that only your test folder is checked under Target Membership.
Make sure that the Search Framework Path (FRAMEWORK_SEARCH_PATHS) for the YourProjectTests target includes the path $(SDKROOT)/Developer/Library/Frameworks, and that this one is listed before $(inherited).
In my case, both paths were present, but $(inherited) was the first one.
Credit goes to https://stackoverflow.com/users/181947/brian-clear on Apple Mach-O linker (id) warning : building for MacOSX, but linking against dylib built for iOS

Xcode Cannot Run on the Selected Destination

I was running my app this morning and now all of a sudden I am getting the following error when I try to run on the iPhone 5.1 simulator.
Cannot run on the selected destination
The destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software.
I deleted the schemes but still no solution.
I am using Mountain Lion. I am using xCode 4.4 (Recently upgraded to Mountain Lion and xCode 4.4)
UPDATE 1: Here is the view of my build settings:
UPDATE: Here is the actual error which prevents from it running.
You might follow the steps:
Quit Xcode and iPhone simulator
Unplug your devices
Goto /Users/your_usr_name/Library/Developer/Xcode/DerivedData/
Delete all data under this folder
Start Xcode again and run your project
Hope this will solve your problem.
I had this issue after updating from Facebook SDK 3.1 to Facebook SDK 3.1.1. My fault, I guess.
Inside "resources" folder, now there is a totally useless but dangerous info.plist that, if imported, may break your project file. Don't know why they included it but I believe few of us made the same mistake recently.
I found this problem with the version of Xcode 4.4. And finally I solved it this way:
Find the "Info.plist" in your project, then unselect the target membership plus on the right side view of window, it works for me.
You might also want to check if the project uses a supported compiler in the project settings
Its just duplicated Info.plist file
just use 1 Info.plist file in files then restart xcode
its fixed for me
I have just encountered this error in Xcode 4.5.1, and the error went away after I take all non-alpha characters out of the Product Name build setting.
I believe this may be a current unlisted bug with Xcode 4.4+. I have/had the very same issue with my project. I deleted all versions of Xcode and restarted with 4.4, opened my project and had the error again.
I then started a new project with a template with a different name. Did not have the issue.
I then renamed my old project, started a new empty project with the same name and built/ran and got the error again. This new project was nothing more than a view controller that didn't do anything. I should have gotten a blank screen but got the same error you did.
Frustrated I shut down for the day and re-ran the old project and it worked. I had not changed anything. Currently I have the error again and neither rebooting or restarting Xcode fixes it.
So in summary, a project can have absolutely no changes made, sometimes it builds and runs fine, sometimes you get this error. For the record I did not get this error running Xcode 4.3.
My issue did not show up until I upgraded to Mountain Lion and Xcode 4.4 which happened to be on the same day. Now I can not get back to a 100 percent workable configuration.
Committing my files to SVN and checking out the project in a new directory fixed this for me.
Look at both the project and target build settings, at that Architectures, and see if anything has changed. When first going from Xcode 3 to 4, it use to wreck havoc in a hidden way, giving the same error, and in the end you had to add i386 to the "Valid Architectures" line. I just looked at my big project started in Xcode 4.1, and it shows nothing about i386 etc, but I have other newer projects where I get this grayed out thing in that line $(ARCHS_STANDARD_32_BIT).
EDIT: I took a relook at this with a guru friend. Neither of us can find a linkage to i386 in our projects - Xcode is using some magic. That said, I did get a hit to i386 in a binary plist within the project, which leads me to another suggestion.
In your build settings, insure that ALL "Architectures" are $(ARCHS_STANDARD_32_BIT).
If that does not work, we suggest that you look at the compile and ld lines of your build when you select iPhone 5.1 Simulator in the scheme menu - to see if in fact its i386,
Another idea - move all your schemes and user settings to a save folder somewhere (with the project closed), then reopen and recreate a scheme. Now try again. There is no reference to i386 in any of my project.pbxproj files, so our suspicion is that this is somehow related to the scheme setting for the target device.
Good luck!
I've solved changing in both the project and target build settings the key "Build variants" from "armv7" to "normal"
in addition to deleting all the files in this directory
Users/your_usr_name/Library/Developer/Xcode/DerivedData/
i restarted my mac and it worked fine (restarting xcode and the simulator didn't cut it for me)
I was running into this same problem. In my case, it appeared to be that I had changed the Bundle Name for my multi-target project instead of the Product Name. Once I corrected that by editing the Project Name correctly and then setting the Bundle Name back to ${PRODUCT_NAME} it would run in the simulator again.
This may not be the answer for everyone, but it does appear that product naming errors (special characters, spaces, etc.) are a contributor for many, and that's what drove me to review the renaming that I had one.
I was facing the same issue with my project. Here's a brief explanation of the situation and my resolution. This may or may not work in your case.
I work at a place which has multiple iOS projects going. I recently had my system upgrade to Mac OSX 10.8 and Xcode 4.4.1. I was working on a project that was originally built on Xcode 4.1 for iOS 4. Since Xcode had iOS 4 simulators until 4.3, the project built and ran fine on all simulators. In Xcode 4.4.1 however, I did not find iOS 4 simulators and there is no easy way to install them either, which is why I was getting the "Cannot run on selected destination" error. Here's how I got my project to run.
Check under Build Settings > Architectures and set Architectures to Standard (armv7) or ${ARCHS_STANDARD_32_BIT} for all your profiles.
Set Base SDK to Latest iOS(<ios version #>) 5.1 in my case.
Set Build Active Architecture Only to NO for all profiles.
Set Valid Architectures to armv6 armv7 for all profiles. You may have to add either depending on what is already available.
Set iOS Deployment Target to iOS 5.1 (in my case) .
Make sure you have the same target under Deployment Target under the Summary tab of your project.
Clean and Run and cross fingers !!
In my case, the problem occurs after removing whole Resources folder, copying Resources folder from other or old project over current one then adding back that folder.
I solve the problem with the help from Analyse tool: after analysing, it warms me about Info.plist inside "Copy Bundle Resources".
Simply go to Copy Bundle Resource (at Build Phrase tab) delete Info.plist, then restart Xcode, clean and build. My project is back to normal.
Hope that help someones :)
I think a lot of these solutions force a full rebuild, which is what solved this for me.
I did Product => Clean, and the problem went away.
For me this worked:- Check all you product references are consistent in the settings and plists. Also check the product name does not contain any SPACE or other "illegal" characters.
try to rename your project. I solved by this way.
Judging from the responses this type of error has many potential sources, so here is my own (admittedly careless) version of the mistake (and simple solution):
XCode project Build Settings can be set at two levels: Project level, and Target level. For those less familiar, target level is where you have your executable app, and often other items like a dynamic library build.
In Linking section of Build Settings there is a option for Mach-O Type, where you can set Executable, Dynamic Library, Static Library, etc..
I was having trouble preparing a dynamic library, was scanning over the build settings for the project and saw Mach-O was blank. So I set to dynamic library. I then went on and reviewed a few more things and forgot I'd made this change. But I didn't realize I was at the overall Project Level, not the Target level for the actual dynamic library. This changed all target Mach-O settings to dynamic library.
And of course the executable target didn't like being treated as a dynamic library, and I got the OP's error message.
Setting the executable back to executable Mach-O at its target-level build settings fixed everything. Annoyingly the project-level setting still said dynamic library, but with correct target-level settings all worked fine.
Silly I know, but since a couple of the more drastic solutions listed above would have indirectly solved for this error I thought I'd share in case someone else had made the same mistake!
The way I solved this error was by a adding dummy function to my project. My issue was my app had no code of its own, only linked-in code.
I have an unusual situation with two projects: one "App" parent and one "Engine" child. All the compilable code is in the child and the parent simply links with the child, copying a ton of App-specific resources into the project.
Apparently this saddens Xcode, resulting in the above error.
My solution is adding this C function / file to the App project:
int workaround_for_xcode_reporting_cannot_run_on_selected_destination(){return 0;}
I restore the data from the time machine. Notice this is the exact same data that has been stored just 1 hour ago. The problem started yesterday. So it should be the EXACT same data.\
Yet it works.
I tried everything metioned here. Nothing worked. It seems that I somehow imported the Info.plist twice. To fix it I selected the project and pressed the "Validate Settings" button. Afterwards it works for me.
After a half day of experimenting, I think this means that the debugger can't find your executable to launch. I think this is an important distinction from the prior answers because its an underlying cause, that can have a lot of symptoms. In my case it couldn't reconcile the apps Info.plist for a custom build where we were copying the plist for the build. I changed the build setting to the Alt-Info.plist for AltDebug and that fixed it. Also meant no more copying.
Your underlying cause might be different, so the key takeaway is think about why Xcode might not be able to find your built app.
You'll be happy to know this problem has a very simple solution. Select Info.plist in your project navigator tree and make sure it is not assigned to a target. I have confirmed this is the correct solution. If building for iOS 6 or earlier you may also need to add armv6 to supported architectures
I had this issue after upgrading to Mountain Lion and XCode 4.4.1 for an OSX project.
To resolve it, I had to upgrade my deployment target to 10.5 or higher; it was set to 10.4 and up.
You have to find in the "Activity Monitor" the Xcode process and kill it! I just did it to solve a similar problem!
I've got this problem after accidentally removing the Resources folder, when I added it again to the project, Bam !
I'm also running Mountain Lion and XCode 4.4 !
trying to find out what's causing this, but it seems to be reproduced when you delete then add the info.plist file ! can someone confirm that ?
I had the same problem after two things happened:
I upgraded to Facebook SDK 3.1
I updated my OSX (with a minor version update)
The only fix worked from me was adding armv7s (mind the "s" in the end!!!)
Like was suggested here:
https://stackoverflow.com/a/12540654/531527
Yet another variant solution: after trying just about everything in the list above, I fixed this by addressing a warning that the TestFlightSDK1 path could not be found. To do so, I deleted the relevant path from Header Search Paths (Build Settings>Search Paths) and removed the TestFlightSDK, and now things run just fine.
I had this from beginning and it looks like it is a problem that the emulator can not handle virtual smartcards. Unfortunately I ended up just using my Android phone connected via USB.
Remove Info.plist from the Copy Bundle Resource build phase.That worked for me!

Xcode 4.1 fatal error: stdlib modified since the precompiled header was built

Building an iPhone app, using:
Xcode 4.1
Base SDK iOS 4.3
Apple LLVM Compiler 2.1
I have started getting the following error:
fatal error: file
'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'
has been modified since the precompiled header was built
I have tried reinstalling Xcode and OS X - no luck. What's causing this?
First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).
If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.
The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.
You can also manually delete the Derived Data:
~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}
This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.
I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.
Deleting the DerivedData folder did not work for me when Archiving.
I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.
For me that was:
/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /var subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows
xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH
This way, I never get the error in automatic builds.
Note in the above command, I would also typically set the OBJROOT and SYMROOT env var to build also in /tmp. At the end, I clean things up.
The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:
/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/
You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.
Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me
Solution:
1)Product->Clean
2)Product->Build
Error Type:
a kind of Build error
One of the causes:
one might have changed the framework file.
This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.
One of the Scenarios:
one might have chosen Jump To Definition and did some change after selecting a framework control.
I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.
I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..
Xcode->delete->install again
It might help some one...
I had this error on cordova when I ran : cordova run ios
fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works!
This tip, may be help others
Clean ways are not working for me, eventually I solved this issue by reinstall XCode.

Resources