PSA: Clang modules being enabled for libc++ for linux builds

170 views
Skip to first unread message

Takuto Ikuta (生田 拓人)

unread,
Jul 24, 2025, 2:53:20 AM7/24/25
to Chromium-dev, Matt Stark, Junji Watanabe

Clang modules are about to be enabled for libc++ for non-official x64 Linux builds in https://crrev.com/c/6703261. This will save 13% of CPU usages in chrome build. Over the next few weeks and months, we will also be enabling this on other platforms.

What does this mean for you?

  • Your builds should be faster, and more strict about missing includes.

  • If you are missing an include, the error message may be different. Where previously an error might look like use of undeclared identifier 'std'. It may now say something like error: declaration of 'variant' must be imported from module 'std.variant' before it is required

Can I use modules in my code?

Short answer: Not yet


Long answer: We are currently investigating the feasibility of making more targets use clang modules. This is different to standard C++ modules, but any target which migrates to clang modules will likely be able to trivially migrate to standard C++ modules in the future, as a migration to clang modules has very similar requirements to a migration to standard C++ modules.


Standard C++ modules are, in fact, no harder to migrate to than clang modules. The main issue with doing so is that it is a one-way street, and the tooling and ecosystem simply aren’t mature enough for us to migrate yet.

What if this breaks things?

We have tested this for all our CI/CQ builders, so It is highly unlikely to break anything. However, if you run an untested configuration with custom flags, there is a possibility that it may not play nice and might fail to compile. If that happens, please file a bug telling us how to reproduce it.


In the meantime, feel free to add use_clang_modules = false to your args.gn file

Reply all
Reply to author
Forward
0 new messages