clang-cl crashed when building Chromium

By | January 21, 2018

The clang-cl crash is a known issue (crbug.com/780124) when building Chromium on Windows. The clang team has fixed it but not yet shipped. The bug only happens with precompiled headers so the workaround is to add this to gn args:

enable_precompiled_headers = false

——

很久沒有 build 過 Windows 版的 Chromium 了。近來多用返 Windows,決定更新一下。

> ninja -C out\Default chrome

但結果第一個 file 就 compile failure!

ninja: Entering directory `out\Default'
[1/33138] CXX obj/base/base/precompile.cc.obj
FAILED: obj/base/base/precompile.cc.obj
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes @obj/base/base/precompile.cc.obj.rsp /c ../../build/precompile.cc /Foobj/base/base/precompile.cc.obj /Fd"obj/base/base_cc.pdb"
Assertion failed: ID < FilenamesByID.size() && "Invalid FilenameID", file C:\b\rr\tmpcwzqyv\w\src\third_party\llvm\tools\clang\include\clang/Basic/SourceManagerInternals.h, line 105
Wrote crash dump file "%USERPROFILE%\AppData\Local\Temp\clang-cl.exe-66ddaa.dmp"

原來 clang-cl 崩潰是一個已知問題 crbug.com/780124,clang team 已解決但還未包裝出來,由於只會在 precompiled headers 出問題,所以可以在 gn args 加入 enable_precompiled_headers = false 便可。