[PATCH] D52193: RFC: [clang] Multithreaded compilation support -- NOT FOR SUBMIT

Steven Noonan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 20:27:20 PDT 2019


tycho added a comment.

I rebased this myself on the release_90 branch and I was pleasantly surprised that I got the merge right on the first try (?!), and it actually works well without any significant changes (other than merge conflict resolutions).

I've run into two problems with it though:

- Running `clang-cl.exe /MP` without a number following the argument doesn't seem to automatically pick up the number of available available CPUs. I haven't debugged that yet, but it's probably a trivial fix.

- Precompiled headers aren't being built properly when using `clang-cl.exe /MP` under Visual Studio. If I do a clean build with e.g. `/MP16`, it errors immediately with this:

> 1>project_pch.cpp
>  1>CL : error : unable to read PCH file .\Release\.\/project_pch.pch: 'no such file or directory'
>  1>CL : fatal error : PCH file '.\Release\.\/project_pch.pch' not found: module file not found
>  1>Done building project "project.vcxproj" -- FAILED.

When running with `-v` on `clang-cl.exe`'s command line, I can see that it starts doing a compile with `-emit-pch` and another with `-emit-obj`, apparently running simultaneously. It looks like the object file needs the PCH to be compiled first, so it fails when it doesn't find the .pch file the other process should be working on. I bumped `msbuild.exe`'s verbosity up to see what it tried to do, and it only invoked clang-cl once, to compile one file (`project_pch.cpp`) with the "emit precompiled header" arguments on the command line. So this shouldn't be too crazy-tough to fix.

(I think my short-term/wrong workaround for this will be to ignore `/MP` when an input file is type `c++-header`. The more accurate solution would be to make the `.obj` depend on the `.pch`)

---

Has there been any further work on this change outside of what's recorded in this thread?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52193/new/

https://reviews.llvm.org/D52193





More information about the cfe-commits mailing list