VS2022 Build Fails with C++ "latest"

After commit [432a7e1c9a], I can only build with C++20.
If I set the language standard to “latest”, I get the following error:

fatal error LNK1248: image size (1003730A3) exceeds maximum allowable size (FFFFFFFF)

I’m on Windows 11, Visual Studio 2022.
Note: you need to rebuild Projucer to reproduce this.

Does anyone know what might be causing this issue? Any suggestions on how to resolve it?

Do you see the same problem in any of the JUCE examples, or only in your own project?

Can’t reproduce this with JUCE examples since they are small projects. However, I can reproduce it with larger projects. In the shared code output, I see that my projects generate a library of approximately 2GB

I’ve noticed a significant increase in Windows build sizes when updating from JUCE 8.0.6 to 8.0.7.

In our shared code folder, the object files for our plugin grew from 2.66 GB to over 4 GB, which causes build errors due to file size limits.

Even the AudioPluginDemo build size increased noticeably: from 117 MB to 205 MB.

This is quite a substantial jump. Is there a known reason for this increase?

We are also seeing this having moved from JUCE 8.0.5 to 8.0.7. I can see that a sharedcode lib on windows built against 8.0.5 was 2.3 Gb, whereas one built against 8.0.7 is now 3.8Gb.

Any ideas on possible causes for this >50% increase in lib size?

1 Like

Following up on this, we’ve determined that this could be down to changes to debug information generation. By default, if you have a project set to not generate debug information at all, it still adds a line for ‘DebugInformationFormat=OldStyle’, whereas before 8.0.7 that setting was ommitted entirely if not generating debug information for a configuration.

We had a go trying different settings and found that for our failing project, using ‘ProgramDatabase’ brought the size down enough to complete compilation, and so did removing the DebugInformationFormat line entirely for configs that shouldn’t have debug information. We’ve made the latter change and can now continue.

Anecdotally, using ‘DebugInformationFormat=None’ also seemed to tip the size over the limit for us, which seemed odd.

3 Likes

Thanks Mike. We’re looking at this now.

We’ve now pushed a patch that changes the default debug-info format to “None” for configurations that are non-debug and without debug info force-enabled:

This should switch off the generation of unused debug info, reducing object file sizes. Please let us know if you’re still seeing problems after rebuilding Projucer against the newest develop branch and resaving your projects.

The issue still persists for me, even after this commit (re-build Projucer and re-saved project).

I also tested the AudioPluginDemo with Force Generation of Debug Symbols set to Disabled. On Windows, the resulting AudioPluginDemo.lib for the shared code it’s 228 MB.

Maybe this is a bit more complex than I originally thought. There seems to be some interaction with the link-time code-generation (LTCG/LTO) flag, too.

I’m seeing the following here for a standard Release config with the following settings changed. I’m guessing I didn’t notice this previously because I was mostly testing in a Debug config without LTCG enabled.

LTO | Debug opt | Size of AudioPluginDemo.lib / KB | pdb size / KB
off | None      |  37 816                          | -
off | Z7        | 123 951                          | -
off | Zi        |  77 700                          | 33 372
on  | None      | 235 128                          | -
on  | Z7        | 235 227                          | -
on  | Zi        | 178 283                          | 33 372

When LTCG is enabled, the None and Z7 configurations both seem to result in .lib files of approximately the same size. The 8.0.5 behaviour was to omit the debug info flag entirely, which MSVC would interpret as the default, Zi. So, if you need LTCG, then I’d suggest leaving debug info enabled with the format set to Zi. Unfortunately, the Zi flag can cause issues with other tools, like sccache, which is why we changed this behaviour. It doesn’t seem like there’s a good default that covers all use-cases: leaving the debug info format as “None” counter-intuitively leads to large file sizes, but setting it to Zi will break third-party tools.

2 Likes