Xcode not compiling any project? 'clang failed with exit code 255'

IphoneObjective CXcode

Iphone Problem Overview


Hey all basically what the title says, I was working on my project with no issues and then all of the sudden it just stopped compiling. The only thing that led up to this was one of my .m files turned red when I accidentally renamed it and I had to delete it and replace it but that was it. I searched around and can confirm it is not my Bundle Id that is causing the issue. I also ran it with llvm-gcc and got this 'llvm-gcc-4.2 failed with exit code 1' and help? Thanks!

ETA: This is also what it says in the little error box:

clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable clang: error: clang frontend command failed due to signal 1 (use -v to see invocation) Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 255

Iphone Solutions


Solution 1 - Iphone

I just had that same error, same situation(the code worked totally fine, then suddenly has that error message). For me I just closed the simulator and opened it again then xCode does not complain anymore.

Have you tried to run your code in device?

Solution 2 - Iphone

This is happening because your OS X install is running into the per-user process limit. And that's happening because XCode doesn't always cleanly kill your process at the end of a debugging session.

On my machine, I have 709 processes allowed per user:

El Smeg:~$ sysctl kern.maxprocperuid
kern.maxprocperuid: 709

Looking at the number of zombied processes on my machine:

El Smeg:~$ ps aux | grep \(GridView\) | wc -l
 608

So you can see that I'm pretty close to the per-user process limit just due to XCode leaving zombie processes around.

Unfortunately, I don't see a good way to kill these off. kill -9 doesn't work. Rebooting seems to be the only fix aside from temporarily raising your per-process limit, which isn't really a fix. You can't kill the parent process because that's launchd and killing that is pretty much equivalent to a reboot anyway.

Solution 3 - Iphone

For me, I just had to reboot (OS X 10.7, Xcode 4.5).

Solution 4 - Iphone

Roboot your MAC, Launch xcode and before doing anything clean up your project (cmd+shift+k).

Solution 5 - Iphone

I have had this a few times. The simplest way I have found to fix it is just to close the simulator.

Solution 6 - Iphone

maybe this could be useful to someone.

I had the same problem, and it is just because I compile with make -j.

As you know, this causes make to use as many threads as possible, and I think one of these threads was using a ressource when another one tried to access it.

Let make -j compile until the error, it will end automatically, and then just do make.

It should work normally.

Of course, you can just compile with makefrom the beginning, but it will be longer.

Solution 7 - Iphone

I just ran into this, closing xcode and reopening it did the trick. I am curious now if purge would have done anything.

Solution 8 - Iphone

I did the clean and rebuild, also did "remove the app from the simulator". The problems just did not go away, sometimes it shows up as another compiler error on a xib file (which is a false alarm). Eventually I did reboot the machine and it fixed the problem.

I recall doing the kill Xcode/simulator process in the past, but can not recall the exact situation.

Solution 9 - Iphone

I tried it with Xcode 11 beta and its not work, I changed the build configuration to Release and its works like a charm. Project---> Edit scheme----> Run ---> Build Configuration---> Release

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAdam AshwalView Question on Stackoverflow
Solution 1 - IphonenluoView Answer on Stackoverflow
Solution 2 - IphoneJason HarrisView Answer on Stackoverflow
Solution 3 - IphonejabView Answer on Stackoverflow
Solution 4 - IphoneriyazView Answer on Stackoverflow
Solution 5 - IphoneAlanView Answer on Stackoverflow
Solution 6 - IphoneJulien Séveno-PiltantView Answer on Stackoverflow
Solution 7 - Iphonej_mcnallyView Answer on Stackoverflow
Solution 8 - IphoneuudaddyView Answer on Stackoverflow
Solution 9 - IphoneAhmed AbdallahView Answer on Stackoverflow