Unity 5 / Xcode 7 / 64-Bit IL2CPP compile times are killing me

It seems ridiculous that a Universal “hello world” using Unity GUI creates a 705 MB Xcode project that takes almost 6 1/2 minutes to compile and install on my iPad or iPhone from my Mac Mini server.

I have apps I’ve been trying to update for the app store to 64-bit (Universal), but they never, ever finish compiling in Xcode 6 or 7.

Xcode doesn’t crash, hang or freeze - I can hit the stop button and it will stop compiling. But it never finishes a build or archive, even after running for 90 minutes. There’s no error messages - over 200 warnings.

Have tried with Unity 5.1, 5.2 the latest patch update, Xcode 6, 7, 7.1, Yosemite, El Capitan, and two difference macs. I get the same result - projects that never finish compiling.

If I set the scripting backend to Mono2x the apps compile and install like normal, but that’s now help since 64-bit builds are required.
I have no idea what to do or how to get these apps to build and compile properly. Ready to throw Unity out and start from scratch with Unreal.

I tried leaving it running with powersaver preferences turned off. It only took 2 hours and 27 minutes for a Universal IL2CPP build to compile in Xcode.

Yeah. 2 hours 27 minutes using IL2CPP Scripting backend.

Using Mono2X, it takes two minutes.

IL2CPP Scripting backend takes 7,350% longer to compile in Xcode than Mono2x.

@Mark-Sweeney

If possible, could we have a look at your project in a bug report? The IL2CPP scripting backend compile times are certainly longer than the Mono scripting backend, but this seems like far too great a difference.

I filed the bug report yesterday Josh, and included a zip with the entire project composed inside. I’m still not having any luck getting IL2CPP backend script to compile in Xcode in a reasonable time.
Bug report/Case No. 732782

@Mark-Sweeney

Thanks, I appreciate it! We will have a look at this project.

How much ram does your mac mini have? I found ram made a much MUCH bigger difference with building times than I thought it would with mine. (although mine was memory starved at 4GB, so I guess that’s why there was such a big difference).

My Mac Mini Server has 8 GB RAM (using it as a mac, not as a server).

My wife’s brand new iMac also has 8GB RAM, and that took 1 hour 40 minutes to compile from Xcode.

If I do it with Mono2X scripting backend, it takes about 2 1/2 minutes.

I’ve been trying to figure it out and not having any luck. Even a basic “Hello World” with just text, using Unity UI took over 5 minutes to compile and install. No scripts, 3D or images of any kind.

Maybe I missed some setting or something that causes these long compile times.

I don’t know if you’ve had any luck figuring this out, but Changing Optimization Level in the Building Setting in Xcode to ‘None [-Oo]’ reduces the compile/install time to 12 minutes and 15 seconds instead of 2 1/2 hours. (6.5 minutes for Xcode to compile, the rest for Linking, generate dYSM, signing and installing).

I got that idea from this thread:

http://answers.unity3d.com/questions/969870/too-slow-to-compile-archive-in-xcode-il2cpp.html

1 Like

@Mark-Sweeney

No, we’ve not yet investigated this issue, sorry. I’m glad that you’ve found something of a work around, although we still need to determine the cause of the issue, as it is probably not feasible to ship with optimizations turned off. I’ll ping our QA team to check their progress on this issue.

I have the same problem with archive. It worked once when i started it over Night but that is way to long !

It worked with the tip of changing the Optimization level to None . Great , Thank you !

1 Like

It’s good for testing on a device, but it’s still a pain to have to let it compile overnight for uploading to iTunes.

I’m going to have to submit another bug report. I have a brand new 27" iMac. Last night, a new build took over 3 hours for Xcode to archive.

I wonder if it has anything to do with Unity abandoning Unityscript, which is what is used in this 5 year old app I’m trying to update.

@Mark-Sweeney

Unity Script might be the issue here. At least, the Unity Script compiler often generates different IL than the C# compiler, so maybe IL2CPP is converting that IL to C++ in some sub-optimal way. Is this the same project you submitted with bug 732782? If so, then there is no need to submit a bug report again.

Just wanted to confirm that compiling IL2CPP takes approx. 7x longer than Mono.

@Cascho01

The difference will depend on your specific project, but that is not surprising. We’re working to improve build times now, though. At the moment it should be possible to do incremental builds with IL2CPP on iOS. So Xcode will only compile the changed C++ files. In the latest releases of Unity, we’ve changed IL2CPP to generate C++ code that is more stable - that is, small changes to managed code will lead to small changes to the generated C++ code.

It’s the same app, but I’ve made a ton of changes and optimizations, and removed all extraneous files. Going to see if it uploads to iTunes connect properly - last time it said I couldn’t use beta software or SDKs - which I wasn’t.

@Mark-Sweeney

Thanks. There is no need to submit another bug report then. I’ll see if we can look at your previous one finally.

I’ve been having the same problem for a while after upgrading Xcode 7.3 and El Capitan that compiling just would not complete. I am so grateful for the tip to set the Optimization level to None for Release! Thank you for the help, much appreciated!

@laphil

You probably don’t want to ship with optimization disabled. It might be better to determine why the build is taking so long. In some other cases we have seen where the build seems to hang, we have lots of local variables and allocations happen in one huge method (maybe 10,000 or more). This usually occurs when data tables of some sort are encoded into script code.

Often you can improve the compile and runtime performance of this code by encoding the data in some serialized format and loading it as runtime.