Source file too large to compile at this optimization level

I get this error sometimes, and I’m not exactly sure why, I don’t get it on all systems.

I can go into much more detail about how to reproduce if required. Happy to test out any flag suggestions to see if it can be resolved!


This occurs when the internal complier data structures become too large. I don’t see this issue too often since we made a considerable effort to reduce the size of the data structures, but it can still occur.

If you are using high optimization, you can try reducing the opt level to -O1 or -O0. Though, I do see it on occasion, in particular with large C++ apps, when debugging (-g or -gopt) is enabled since Dwarf information uses a significant about of memory. If you are using “-g”, try removing it for this file.

If you can provide a reproducing example, I can create an issue report and have our engineers take a look.


Thanks Mat, I do recall removing “-g” would let it build in one instance, but not always.

I will put together a docker container built from

It seems like I can reproduce this reliably on debian:testing and fedora:32, but on nothing else.