Deleting Derived Data from Xcode 4.2 project doesn't re-index project - xcode

Indexing, code completion, & coloring disappear from my projects on a fairly regular basis, usually right after I add a file. And then it returns hours or days later, usually for unknown reasons (I've tried keeping a record but it's pretty random). CMD-clicking on even known terms (like viewDidLoad: or NSLocalizedString) result in a "Symbol Not Found" error.
It happens with Xcode 4.2 (I believe it happened in Xcode 4.0.2, but not as frequent).
I have no build errors, warnings, or static analysis messages.
I've restarted Xcode.
I've tried turning precompile off.
I don't have a case where I've got a circular header file include/import.
It happens if I use gcc, LLVM, CLang (in whatever combo).
It happens if I use iOS 4.3 or 5.0.
I've tried deleting the "derived data.", and even only the Index/ path.
After deletion & re-build I see the .hmap file & .xcindex folder (filled with db.xcodeindexdb* files).
...but I can't get code-completion, symbol detection, or coloring back.
What else can I do? I sincerely appreciate the help.

Have you tried a clean install (sudo /Developer/Library/uninstall-devtools)?

I have exactly the same problem for one particular project. Following workaround works for me: apart from deleting Derived Data , I make an SVN update or revert any file of the project. If the project file itself is changed my Xcode displays wrong target ,so I close the project and re-open it and then indexing starts properly.

The most reliable way I've found to force re-indexing of the project is to change the build settings, specifically 'Run Static Analyzer' - I wish I had a real answer though.

This might seem like a silly response, but have you tried to repair file permissions under disk maintenance?

Your thread is old, but anyway...
Deleting the derived data folder helps me everytime. I have to do it quite regularly, which is very annoying. Your find the path in the xCode-Settings(cmd+,) in the locations-tab.

I just had this issue. What worked for me is clearing the derived data, then closing the project and re-opening it. It didn't reindex until I closed and re-opened the project. The project never compiled fully, so it didn't even have to finish building to work.

Related

Xcode build products folder won't change to Unique

I don't recall having this problem before I migrated to my Retina MacBook Pro, but since doing so, my projects have insisted on loading in the "old" development location. In years past, before XCode 4, we put all our products in /Development/Products. And, after migrating to the new MacBook Pro, they're going back there again. I can use 4.3 or newer and see the same problem with both, so I'm assuming it's some kind of configurable that's at work here.
Of course, the first thing I did was verify that the Preferences/Locations was set to Build Location = Unique. I confirmed this both in the GUI and by popping open the .plist to check the value of IDEBuildLocationStyle and it was set to Unique.
I tried removing my existing configuration files (everthing in ~/Library/Preferences/ named Xcode) and that succeeded in changing the behavior to putting the output in the build directory of the project itself (really not helpful in my world as I have complex multi-project workspaces). Quitting and checking the settings, they were set for IDEBuildLocationStyle=Unique.
So, I copied the working configuration from another machine I had to this one. Since it too had previously had the /Development/Products destination, but had subsequently been moved to the Unique build style, I expected that to work. It did not. It instead returned the output to /Development/Products.
Thinking it might be something with my Xcode install, I created a new user and built from the same source tree (not a duplicate, not a copy, the exact same files). In this case, the output went to the right place (unique subdirectory of the Derived Products for that user). So, I blew away the ~/Preferences/*Xcode* again and copied in the preferences from the new user. Unfortunately, this took us back to the same behavior that the uninitialized configuration had, which is to say building in the build directory of the project itself.
I restored to my backup configuration files, and now I'm back to working at /Development/Products, but this isn't a good long term solution.
When checking the script output for a test script, I can clearly see that somebody is setting SYMROOT to /Development/Products in the case of the older config, and build in the case of the default configuration file.
Clearly there's something here on this system that's influencing the configuration, but I cannot figure out what it is. Any assistance would be highly appreciated!
Also - When I try to use option-Clean to enable Clean Build Folder, it is never enabled, which makes a certain kind of sense, but I thought it might be another data point.
I tried the solution in Strange behavior of Xcode Build Products Path under Build Locations and that had the same result as deleting the preferences: build products as children of the project directory.
Has anyone else seen such a problem? Have you found a solution?
Well, after a very long time of suffering through this on my laptop, I was finally able to track down the problem.
Inside of:
project.xcworkspace/xcuserdata/<user>.xcuserdatad/
there is a WorkspaceSettings.xcsettings file.
It contained a key BuildLocationStyle, which was set to UseTargetSettings.
Deleting the file and thus resetting this value allowed me to get both the Clean Build Folder... working and to get my project building correctly.
Hopefully this will help somebody else.

Xcode fails without specifying and errors

All of a sudden my project fails to build in Xcode. If I look at the log I see all the needed dependencies being built, and then I get a strange error:
Verify final result code for the complete build operation
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
I removed my code directory and replaced it with a backup, did a clean, tried building all the other components separately (they succeed) - nothing works. I tried a command line build, same issue.
There were only a few hits on google for this error, none offered any useful advice.
Can anyone please help?
Update: When I run the command line build, I see the following error:
2012-05-25 08:55:53.830 xcodebuild[3358:4203] No recorder, buildTask: <Xcode3BuildTask: 0x400f35e60:'ProcessPCH MyProject-Prefix.pch':REfc(32370056113422336):deps=0:phaseNum=4>
I checked the output of xcodebuild and it is returning '65'.
I thought there might be a problem with the MyProject-Previx.pch file, so I shut off "Precompile Prefix Header", and now I get the same error with a different file:
2012-05-25 09:15:11.784 xcodebuild[3882:3703] No recorder, buildTask: <Xcode3BuildTask: 0x40048ab60:'CompileC HelperRoutines.m':REfc(33777199068741632):deps=0:phaseNum=4>
Build operation failed without specifying any errors. Individual build
tasks may have failed for unknown reasons. One possible cause is if
there are too many (possibly zombie) processes; in this case,
rebooting may fix the problem. Some individual build task failures (up
to 12) may be listed below.
I've run into this problem consistently recently while running Xcode 9.0 Beta 3 and Xcode 8.3.3.
The fix is to delete ALL in the Derived Data folder. It then seems to work again.
rm -rf ~/Library/Developer/Xcode/DerivedData
NOTE: just cleaning the build or deleting the current build folder for a project does not seem to help.
Hope this helps :)
I was hitting this error and it infuriated me for an hour or so. The answer below helped me out a lot: essentially your machine has a ton of running processes, XCode can't handle it, and rebooting your machine is the best answer.
https://stackoverflow.com/a/13183522/1863655
I looked around for a bit and the only one that worked for me was shortening my project folder name.
All other tries: restarting, recloning, deleting derived data, etc. didn't work. The only thing that worked was making the project folder name shorter.
I also encountered same error. I was edited .pch (Prefix Header) file. Then I started getting this strange error.
Then I removed all editions which I made in .PCH.
Then I quit my Xcode.
When I restarted Xcode this strange error was gone.
Hope this will work for you also.
Best luck Buddy (y)
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
This happens occur when the total path length is too long.
change the folder name or location of directory, shorter then before.
Happy 2019, everyone, but sad to say this can still happen in Xcode 10.2.
I had four projects open in Xcode but only one failed in this way. I tried a main menu > Product > Clean Build Folder. The little progress spinner started up and 5 minutes later was still spinning. Hmmmm.
So I quit Xcode and in Terminal did a cd ~/Library/Developer/Xcode/DerivedData. Although ls -alww showed only one subfolder named after each of my other projects, as expected, there were five subfolders whose name began with the name of the problem project. I deleted all of them
rm -R ProblemProjectName-*
and relaunched Xcode. Problem solved.
Mine gave this error sometimes, also LLVM failed with exit code 1 and clang failed with exit code 255, at different code locations each time. I just had to reboot (OS X 10.7, Xcode 4.5).
I rebooted, no luck. Then I noticed that when I relaunched XCode, one of my tabs was loaded with no file in it. I figured out what file I was editing in it, opened it, saved it and then I was able to build.
None of these answers worked for me on XCode 5.
Luckily, I'm still only testing XCode 5 - I kept XCode 4 around.
XCode 5 simply won't build one of my two projects, claiming that my libraries aren't built with the right settings, and I keep running into the error described on this page on the other one... so I'm sticking with XCode 4, which builds both of my projects perfectly well.
If you are experiencing this issue on XCode 5, consider "reverting to XCode 4" as another strategy.
Overall the idea that repeatedly running a program, XCode or not, degrades your system to the point where you have to reboot does not fill me with confidence in that program.
With Xcode 5.0.0, this error was caused after an update to the CLI tools.
Updating to Xcode 5.0.1 and installing all the required components again still didn't fix the error. However, 5.0.1 was kind enough to actually emit an error that was useful.
/bin/mkdir -p /Users/xxx/Documents/XCode/SampleApp/bin/SampleAppDebug.app/Contents
error: (null)
This lead me to look at the bin folder, and find out that the 5.0.0 build with broken CLI tools had made a symlink in bin/ to the derived information folder with SampleAppDebug.app, which for some reason it could not write to.
I manually removed all contents of the bin/ folder and rebuilt without errors.
I faced same problem. I have change my System time.I delete file "/Users/YOURNAME/Library/Developer/Xcode/DerivedData/ModuleCache/YOURBUNDLEID/UIKit.pcm". Then it's work fine for me. Try this.
I added into the Framework search paths the header file location.... removing this from the top level project settings fixed the issue for me.
Change at your peril.
The only workaround, that works for me - push your code to git repo and clone it to new location.
I highly recommend to reclone your repo, because you'll deal with some random problems if you prefer rebooting/turning off and onXcode.
did you set "Perform Single-Object Prelink" to Yes?
try turn it off.
i had the similar problem. i have tons of files in a static library. reducing the number of files or setting "Perform Single-Object Prelink" to NO solved my problem.
Same error and following didn't work for me for Xcode 6.3.2 on Mac OS X Yosemite 10.10.3:
Git discarded changes to last successful build point
Creation of new fresh project from scratch from a builtin template (though I cannot recall whether it built successfully or not)
Restart of Xcode
System Reboot
and the following worked:
I faced the problem in the morning and it got resolved in the evening with a couple of Xcode restarts and System reboots and creation of new project. So, I'm not sure what really triggered.
I faced the same problem today. Cleaning the DerivedData and cloning the project somewhere else didn't help. What fixed my problem was repairing the volume from the Disk Utility app and removal of all Xcode plugins.
I have encountered same issue without having any code changes for my project running on Xcode 9.2. It looks like if you have some run scripts or external build systems attached to the project, this might cause an issue. Try committing or discarding changes and build again. If it still persist, delete local repo and clone again. Also maintain smaller folder names for project location.
Same issue when added watchOS target inside iOS app, using Xcode 11.1 with SwiftUI:
Go to menu Xcode / Preferences / Locations
Open Derived Data folder in Finder clicking on the arrow next to /Users/yourUserName/Library/Developer/Xcode/DerivedData
Locate your app Derived Data folder and delete it
Menu Product / Clean Build Folder
You should be able to compile again.
I know this is super late to answer but I'm answering since none of the above solutions worked.
For me restarting, clean building, deleting derived data nothing worked.
Because the issue was not due to any zombie objects or something like that.
I'm using Xcode 11. I think it's an Xcode bug that sometimes errors are not shown in the issue navigator. But don't worry check the build report in Report navigator(The last tab in project navigator: the one that looks like a comment box with lines in it. or simply cmd + 9).
Click the relevant build and resolve the issue, mine was missing file in pods directory.
just try to rename the folder name of the project. it did the trick for me
I had this same problem, however the accepted solution did not work for me, what worked was:
deleting .workspace file
deleting Podfile.lock file
deleting the Pods folder
pod deintegrate ; pod install
For me it was fixed by changing to the new build system(in File -> Project settings)
I have Xcode 11.7

Xcode not predicting

Am new to objective-c and xcode, and i love programming with them. But am facing a problem with xcode this has occurred quite a few times before, i.e the xcode's Auto-Suggestion mode is not working.
By Auto-Suggestion i mean- when i type say two letters 'UI..' xcode predicts the remaining word to be "UIColor, UIButton, .. etc".
Same for the instance methods eg. you type 'init ' and a list is shown as "initWithFrame,
initWithNibName, .." and so on, which makes coding so easy.
But after i performed some operation like undo or delete i don't remember what i did exactly, this auto-prediction is not working and this is happening only on a particular file.
Any idea what i did wrong to make this happen?
Thanks
Xcode sometimes freaks out and exhibits this behavior. Best you can do in this case is clean your project (cmd-shift-K), close Xcode, then re-open it.
I have noticed this behavior especially when using #defined macros extensively.
I know this post is old, but the correct way to resolve this issue is to clear your derived data. After cleaning the derived data and restarting Xcode, your project will say "Indexing" which is the process of setting up everything required to make this feature work. After that, everything should work again.
To clear derived data go to Xcode->Preferences. Then click the little arrow next to the path to the derived data folder. Finder will open with the projects in derived data. Simply select and delete the one specific to your project giving the issue (Don't worry, this will not affect your project).
If there are any compile errors, then also prediction doesn't work properly. try resolving them first.

When and why should I clean the build in XCode

Every once in awhile, the solution to an aggravating problem in XCode is to hit Product → Clean, and this seems to clear some cache and problems disappear.
But what is it actually doing? And more importantly, WHEN should I be doing this? It seems to be necessary more often when dealing with Core Data, but I haven't really been tracking it.
As a side question, WHY is this necessary? XCode seems to do a lot of stuff in the background (autosave, autocompile, etc). Why doesn't this also just happen in the background?
It's because there are a lot difference when you are working with a very very big project with a lot of files and objects. Imagine that you need an hour to recompile a entire project, so you will think before do this. But in our world, this is a fast task.
XCode use the make program. So, it compile only what was changed.
I can list same cases you need do this:
Always you will create a App for App Store. This safety thing to do.
Always you use the XCode Snapshot. I have bad time when I restore a project and build the app. XCode used old compiled files and a lot of time was lost to search it.
Maybe when you restore a old code with git. Is the same idea of the Snapshot
When you delete or rename a file in project. It don't delete the compiled file, so the program can work, but if you recompile, will see the errors.
When you see that sometime the build have a strange behavior. Or only to have certain that XCode use only your newer files.
I don't remember exactly but i have seen the build use old #defines. Rebuilding can make you more safe about your program. But don't need do this all time.
I am almost certain that XCode loses track of things and sometimes it doesn't recompile (or link, not sure) everything is needed. I have to resort to clean and build all most often than it should. Maybe it's just me, but I doubt it... XCode is the IDE with most bugs I have worked with

Xcode 4.0 hangs on loading project due to the corrupted repositories?

I was trying to commit some changes, Xcode was hang on bringing up the changed files. So I killed (Force Quite) the Xcode. Then next time when trying to bring up my project, Xcode just hangs on loading project. Firstly I thought that maybe my project file was corrupted, but it still the same behavior with my backup project file. So I guess that the default repository for my project is corrupted.
The question is - where is the location of the default repository for my project? can I "remove" it to see if Xcode can starts up properly w/o it?
In XCode 4, you'll find the output contents for the project ~/Library/Developer/Xcode/DerivedData
I'm having this issue as well, intermittently with several projects. I suspect Lion resume as at least part of the culprit as I've had some success with deleting the content at:
~/Library/Saved\ Application\ State/com.apple.dt.Xcode.Lion.savedState
I'm presently reinstalling Xcode to see if that clears things up. A very Windows thing to have to do, eh?
[Sorry for hijacking such a dated thread.]
When we stumble upon this issue (it happens a lot lately) we usually remove ~/Library/Developer/Xcode/DerivedData/YOURPROJECT_RANDOMSTUFF and restart Xcode.
Usually the hang comes along with Xcode using all available RAM and causing the machine to swap heavily.

Resources