Xcode stuck / hangs when compiling source files for Unity project
When building my Unity project for iOS in Xcode, Xcode just stays stuck at "Compiling 286 of 286 source files" forever. During this time, the memory usage keeps growing until the system crashes.
I'm using Unity 5.4.2p4 and Xcode 8.1. I don't know how to test on iOS now. Any ideas? Thanks!
This is the task that never completes running:
Showing All Messages
CompileC /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Bulk_Assembly-CSharp-firstpass_2.o Classes/Native/Bulk_Assembly-CSharp-firstpass_2.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio Sky"
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -gmodules -Wno-trigraphs -fno-rtti -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -miphoneos-version-min=7.0 -g -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -fembed-bitcode-marker -iquote /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/audioky-generated-files.hmap -I/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/audioky-own-target-headers.hmap -I/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/audioky-all-target-headers.hmap -iquote /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/audioky-project-headers.hmap -I/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Products/Release-iphoneos/include -I/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky/Classes -I/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky -I/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky/Classes/Native -I/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky/Libraries/bdwgc/include -I/Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky/Libraries/libil2cpp/include -I/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/DerivedSources/armv7 -I/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/DerivedSources -F/Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Products/Release-iphoneos -DINIT_SCRIPTING_BACKEND=1 -fno-strict-overflow -include /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/PrecompiledHeaders/Prefix-diondljbljkooaghkektdhbqamzg/Prefix.pch -MMD -MT dependencies -MF /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Bulk_Assembly-CSharp-firstpass_2.d --serialize-diagnostics /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Bulk_Assembly-CSharp-firstpass_2.dia -c /Users/Chetan/Dropbox/Development/audiosky-build/iOS/Audio\ Sky/Classes/Native/Bulk_Assembly-CSharp-firstpass_2.cpp -o /Users/Chetan/Library/Developer/Xcode/DerivedData/Unity-iPhone-bpzgklgpqhefexbztpigmjvnyunb/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/Bulk_Assembly-CSharp-firstpass_2.o
Answer by chetan51 · Dec 08, 2016 at 06:14 AM
I narrowed it down to the ProceduralToolkit Unity library. Once I removed that from my Unity project, it started building in Xcode again.
You sir, you are the real mvp! I want to kiss you very hard in a non homo way!
how did you narrow it down to the ProceduralToolkit library? I'm pulling my hair out with this (same issue but not using ProceduralToolkit)...any clue as to how you did it would be awesome.
I created a new, empty project, and added assets to it from my project until it exhibited the same symptoms. I used binary search to speed up the search time. Good luck!
Well it took forever to isolate each library since our project has deeply integrated quite a few 3rd party tools over the years...but in the end it was an outdated UnitySerializer library (which is no longer a supported tool) that was the culprit. I simply ripped out the package, installed the much more robust Newtonsoft json.net library from the asset store and converted the dependencies. Nothing to it :|
So in the end, since there are no obvious flags, errors or indicators pointing in a particular direction, yours seems the best solution unfortunately.
Hello, developer of ProceduralToolkit here. The problem was in IL2CPP compiler, it couldn't compile a very large array initializer. This problem is fixed in the latest version of toolkit, no idea when there will be a patch from Unity.
Answer by defic · Feb 02, 2018 at 11:44 AM
With XCode 7.3.1 everything works fine, but on XCode 8 and 9, the same problem occurs. We are not using ProceduralToolKit. We are using Unity 5.5
Answer by GroznyBear · Sep 21, 2018 at 01:35 PM
try build your xcode project using xcodebuild
command-line tool
> cd <your-project-directory>
> xcodebuild
Answer by p_tah · Mar 04, 2017 at 04:31 AM
Wondering if anyone else has had this issue and/or found an alternative solution? I have pretty much the same symptoms...project compiles forever while the memory usage increases over time
I thought it was due to a high volume of 'Unused variable' warnings I am now getting after updating to xCode 8.2.1 but apparently they can be safely ignored (although i'm not sure why they're suddenly appearing). My project is pretty huge so while process of elimination is possible...it's a really bad idea. How do I properly debug the compiler process?
Same here. I still can't find the cause of problem with similar symptoms.