RFR: 8321533: Clang build for Windows

Magnus Ihse Bursie ihse at openjdk.org
Fri Dec 8 16:03:14 UTC 2023


On Thu, 7 Dec 2023 15:52:46 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> I'd like to propose a new toolchain for Windows using the clang-cl compiler frontend.
> 
> Clang-cl is available as an optional feature in all Visual Studio editions, including the free-for-OSS-development community edition.
> 
> Clang-cl command line is mostly compatible with cl. However, clang-cl offers a distinct set of diagnostic messages and warnings, which can be used to improve code quality.
> 
> In order to use the clang compiler:
> - install Visual Studio 2022
> - install C++ Clang Compiler (https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170)
> - configure `--with-toolchain-type=clcl`
> - compile as usual.
> 
> Note: at this moment the code does not build; I plan to submit separate patches that fix the build problems separately. For the impatient, [this patch](https://github.com/djelinski/jdk/commit/d67a16244f4e6db8e6e8c59266bebd17827bc2a5) should be enough to compile the JDK, and [this one](https://github.com/djelinski/jdk/commit/1580e7cf54cca61d3ab58891619553994ea26b10) is needed to get tier1 to pass.

And, oh, I must say that I think "clcl" as name for the toolchain is really bad. :-(

I think `microsoft-clang` would be the best and clearest name. Possibly, we should rename `microsoft` to `microsoft-cl`, and use `microsoft` as an user-facing alias. At least if the rest of the toolchain is 100% the same as in the current `microsoft` toolchain.

Doing that will present both a risk and an opportunity: if we are checking the toolchain using "findstring" for "microsoft", but we really only want to match `microsoft-cl`, then it will break, so any such instances must be discovered and checked. On the other hand, if we do want to treat `microsoft-cl` and `microsoft-clang` the same, then a "findstring" instead of a "filter" will actually do the trick.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17019#issuecomment-1847444124


More information about the build-dev mailing list