Unity 2022/23 - Windows Standalone IL2CPP build fails due to C1001: Internal Compiler Error

^^
No matter what version of MSVC, Windows SDK, Visual Studio or the Unity editor(2022/2023) I try. I cannot get a BLANK project to build for Windows standalone IL2CPP?? I have tried multiple machines all with the same results. What is going on? Sometimes it even crashes my entire machine when it fails. I can’t be the only one seeing this, am I?? I have logged a bug, ref number: IN-54629

I’ve just confirmed this happens on a fresh Windows install too.

So i noticed your project is on onedrive. Maybe thats the issue? Have you tried another folder?

This is very weird! We’ve seen compiler errors before, but generally not in a blank project. Thanks for submitting the bug report, our QA team will follow up on that.

In the meantime, can you let me know what the C++ Compiler Configuration option in the Player Settings is? That will indicate which command line options we are providing to the C++ compiler.

@hypotoad0 - No, thats just a default location for the documents folder on new win 11 installs. you can turn off the cloud features, they just work like normal documents/downloads/photos folders, etc. I have also tried this on an older build of win 11 that doesn’t do this, for the record.

I did play around with the config options around the Scripting backend. Different compiler configs (debug/master) don’t seem to make any difference, neither does the IL2CPP code generation options or the incremental GC option. The included screenshot shows the last set up I tried.

Could it be to do with packages/dependencies? The project has Burst added as a dependency of the maths package? Would it be worth stripping out packages?

9339767--1306658--C1001_compilerError_buildConfig.jpg

Yes, some kind of high level package bisection might help. Often these compiler errors come from code in unexpected places, so if we can narrow down the set of packages that trigger it, that would be very helpful!

Stripped out each package one by one, trying to build each time. Same failure each time. Every 5 attempts or so, the compiler would crash my entire machine. I don’t even understand how that’s possible. When I got to the end of all the removable packages, I removed the entire 2D feature set to clear the entire package window. From that point on, every time I would try to build it would crash my machine each time. This happened 3 times in a row. I updated Vis studios build tools to 2022 (was on 2019), and now the crashing has stopped, but the build error remains. On a completely empty project, devoid of any packages. Unity 2022.3.9.f1. Whatever C++ tools the current version of vis studio 2022 recommends.

Pretty wild that I’m not seeing anyone else bring up these issues on the forums, its happening for me on multiple machines.

I’ve had so many insane issues with unity this year. From wiping my entire repo history with Unity collaborate because I missed a few emails, to support tickets that have been sitting in ‘not seen yet’ state for 5 weeks now, to general website and portal issues, to now, fundamental undebuggable build issues with the core product. The company I’m with rn pays for like 12 industry seats, I’ve been using the product personally and professionally since 2012. Its always been janky, but this year has been another level. Lets not even mention an absolutely shambolic communications job with the new licensing terms.

I’m gonna leave this one to your QA guys, and roll with mono for now. Maybe a competitor or something tomorrow. For the record, I appreciate you @JoshPeterson chiming in here. It’s been tough to get a hold of someone.

Yeah, this is really odd. Internally, we have thousands of tests that do this every day. If your team does dig into it more, let me know, I’ll be happy to continue to try to help.

So coming back to this, (apologies for previous frustration) I asked a friend to try on their machine, they had no issues. They are on an older install of windows 10, which is the only significant difference I can think of. One thing I noticed that was different about their installation process and mine though, was when they selected the modules to install, just the IL2CPP windows and the Visual studio module. it installed visual studio with a simple ‘ok’ click on the vis studio pop up. Where as when I try it, on either of my machines, instead it installs visual studio installer, which then brings up this window?:

9363674--1309418--upload_2023-9-24_16-31-30.png

Asking me what modules to install. If I don’t select any, and leave this screen open. Unity Hub will continue the editor install and say that visual studio was successfully installed? Without me installing any of these modules? Am I supposed to be seeing this screen during the install process at all? It seems odd to me because unity doesn’t tell me what modules I need, I’m basically just guessing? All while Unity hub says the vis studio module is successfully installed:

9363674--1309421--upload_2023-9-24_16-35-4.png

And then when I try and build I get this:

9363674--1309424--upload_2023-9-24_16-35-23.png

Am I supposed to be guessing which modules I need from visual studio? I assume if unity intended vis studio to prompt me like this, they would at least tell me which modules I need? This is on a clean windows 11 reset btw. Starting to think it must be a hardware issue, but I have tried on my laptop and a windows sandbox with similar results. So pretty much out of ideas here.

That’s weird, you shouldn’t have to select individual modules in the VS installer.

The things you need from that installer is the C++ workload, including any Windows SDK.

Hmm, I wonder what could be triggering it. This is on a fresh Win11 reset.

Yeh I figured as much from what I could gather from other sources. These are the last components I’ve tried:

9366167--1309841--upload_2023-9-25_14-8-22.png

But have tried pretty much any combination possible, all with the same results.

Are you still getting this error? Or is it different now?

nah same error. The above screen was just showing what happened when I didn’t install any modules in VS as it prompted me. I’ve since installed the below components and am still getting the original error:

That is really bizarre :(. For whatever reason, the Microsoft C++ compiler is just crashing on your machine. The fact that it happens on both of your machines is even more weird since we haven’t seen it internally. Do you happen to have any virus scanner or any other program installed on both machines that could potentially interfere with the compilation process? How much RAM do you have and how close is it from being exhausted when this error occurs? Is the page file enabled & functioning? Do you have a reasonable amount of free disk space?

Yeh v strange its on more than one machine, its been a minute since I’ve checked this on the other machine, so I’ll do that again. I have tried hosting the test project and building on both of these drives:

Shouldn’t be anywhere near the RAM limit:

My 2019.4 project is massive (pretty much that entire C drive) and it builds IL2CPP fine, its just 2022-on for some reason. This test proj I’m trying to build is a basic 2D proj on 2022.

Yeh… trying to think of commonalities. Non that I can really think of, beyond both having the most up to date version of win 11 and the fact both machines would also have had 2019.4 installed. (both can build 2019 IL2CPP) I’ll compare the two installed lists on both machines, but I usually try and keep things fairly lean. I do install games that I would imagine use the system’s C++ runtimes, but not the compilation tools surely, and I wouldn’t be running anything like during compilation.

I have an older win 10 machine I might be able to try.

How do you mean page file enabled? My system does page stuff as it shows in the screen grab, but I’ve never thought about it?

Looks like it’s enabled from your task manager screenshot.

How is this problem solved? i have the same prpblem

So this turned out to be a suite of incredibly irritating hardware issues that were v hard to track down, and that all contributed to the same problem. The problem fully resolved itself when I killed all overclocks on the machine, reset all hardware to stock, reinstalled windows on a new drive and swapped the GPU. My machine had come from the factory with overclocks that I was unaware of. In particular the ‘Intel XMP’ profiles for memory. As I understand, these are supposed to be specially crafted overclocks for RAM that come with many sticks of DDR5 these days out of the factory and they are supposed to be specifically calibrated for your processor, but on my machine it was causing a lot of these crashes, turning this off in BIOS improved stability significantly. Another problem was an ‘OC genie’ that was active on my MSI motherboard BIOS that applied a suite of overclocks to my processor and fans etc automatically. The build came from the factory with this active too. Turning this feature off increased the rate of successful builds again. After tying to install windows many times through system restore on the same drive it didn’t make much difference but when I finally swapped out the boot drive and did a full clean install on another drive I did notice an increase in stability, across the board, including when just running games etc. Then finally my GPU failed. This I think was just a coincidence because it was never overclocked and I never drove it that hard honestly, but swapping it out for an older GPU (3080) when it finally got bad enough has pretty much made the machine rock solid for the first time, and I can build IL2CPP 100% of the time now no matter what burst/jobs configuration I have active (these configurations did matter to the original problem). The clue to the hardware issue I think was the blue screens. I would always get the build errors I posted here, but every few attempts my machine would also blue screen, so this hinted that it was something hardware related. Also the fact that unity couldn’t reproduce it. I did try on another machine and it had similar issues though. That is still a mystery, i never really bothered to debug the other machine in the same way, but it wouldn’t surprise me if that machine had SSD issues too. Basically, I would bet on hardware issues, and if you aren’t in a position to change or fix any hardware stuff right now, I would look into your compiler/jobs/burst configuration, which did make an impact on the rate of successful builds I was getting with this problem. Things like which C++ branch to use and whether you go for faster runtime vs smaller build in the player settings. That sort of thing. Jobs performance optimizations made it more unstable I think.

What’s your CPU model? I find that this issue might be caused by the Intel 14th generation CPUs.