[llvm] [cmake] Make CMAKE_BUILD_TYPE=Release the default (PR #174520)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 9 23:00:37 PST 2026
boomanaiden154 wrote:
> In general, I think this is the right direction to go. (If we wanted to enable assertions by default, then I would argue RelWithDebInfo is a more useful default because we'd get assertion stack traces that are actually useful.)
> Debug builds do work out of the box, just not on something as massive as we've become. IMO, this change (while good) is a red flag. If we want our project to be approachable to new contributors, we need a deeper analysis of how to improve the new contributor experience, including how to get a handle on our build requirements (particularly given how unavailable RAM has become and will remain for the near term).
Thinking back to when I first started building the project ~3 years ago. I ran into this exact problem in my first couple days of hacking. I tried a debug build and very quickly ran into memory limitations around linking, despite having a machine built from cobbled together server hardware with 128GB of RAM, which is much more than I think would be typical. I tried a bunch of things (split dwarf, etc.) but the only thing that really worked there was switching to a release build (which is what I now do most of the time) or significantly limiting the maximum number of parallel link jobs.
Overall I think this change makes a reasonable tradeoff. Someone without knowledge of build scalability problems in large C++ projects (probably most people) will be able to more easily build and will get something that works reasonably well. When someone wants to start debugging they can take the step to change the build mode, but I don't think attaching a debugger is actually the common case. I don't even know if I attached a debugger in my first ~month of working on LLVM. This also causes little friction for existing developers. We already have to explicitly specify `CMAKE_BUILD_TYPE`, so this might be a small win if all you want is a release build.
> including how to get a handle on our build requirements (particularly given how unavailable RAM has become and will remain for the near term).
I think the best way to do this would be to ship a docker container with a prepopulated ccache. That way someone can immediately start hacking, even with relatively weak hardware. We could also ship it with the clang toolchain we use for premerge, which is ~40% faster given it's peak (ThinLTO+PGO+BOLT) optimized. It would be a very opinionated setup, but it would've been exactly what I wanted when I didn't have access to powerful machines during my undergrad for working on LLVM. But that's a separate workstream.
https://github.com/llvm/llvm-project/pull/174520
More information about the llvm-commits
mailing list