RFR: 8321533: Clang build for Windows
Daniel Jeliński
djelinski at openjdk.org
Tue Dec 12 14:19:32 UTC 2023
On Mon, 11 Dec 2023 14:37:35 GMT, Magnus Ihse Bursie <ihse 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.
>
> So, in this case, I believe that if it is possible to reuse warnings from "normal" clang, and the rest of the build process from the existing microsoft-cl toolchain, then the impact might be very small in the code. But it will require some surgery in the toolchain logic, to separate the actual compiler from the rest of the toolchain.
>
> It can certainly be done, but might take a few iterations back and forth to get it right. But maybe that's the sort of thing that @TheShermanTanker enjoys?
>
> So my verdict is that we can't really accept this PR as it is, but using microsoft-clang is definitely an interesting experiment, and we should lay the groundwork for being able to implement it in a proper fashion. And if it then actually can be implemented with minimal impact to existing code, then we should do it.
@magicus just to make sure we are talking about the same thing, are you suggesting configuring the compiler separately from the toolchain, using something like `--with-toolchain=microsoft --with-compiler=clang-cl`?
Technically that could work. It still doesn't address the argument that no organization is going to take up the task of maintaining this setup.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17019#issuecomment-1852123265
More information about the build-dev
mailing list