Anyone uses Clang 3.8 and higher on Windows with MinGW-w64?

I can't get it to work, Clang 3.8, 3.9 and 4.0 appear to ignore PATH
environment variable and fail to find MinGW headers, while Clang 3.7
and 3.7.1 can find and use them just fine.

Anyone tried Clang 3.8+ versions with MinGW-w64?

clang works fine with mingw-builds from https://sourceforge.net/projects/mingw-w64/

‫בתאריך יום ב׳, 20 במרץ 2017 ב-6:31 מאת ‪Constantine via cfe-dev‬‏ <‪cfe-dev@lists.llvm.org‬‏>:‬

It’s far from being drop-in replacement for GCC.

At MSYS2 we have patched Clang working only a little better than installed from LLVM website but there is still a lot to fix.

Clang from official installer works if you copy “C:\mingw64*” to "C:\Program Files\LLVM".

P.S.

Use reply to all on LLVM mailing list.

Oh, I found what was the problem: Clang 3.8 and higher defaults to
x86_64-pc-windows-msvc target that straight up ignores MinGW headers,
but if I specify the mingw target in a compile command:

clang -target x86_64-w64-mingw32 main.c

It compiles fine, both for copied "C:\mingw64\*" in "C:\Program
Files\LLVM\" folder as Mateusz suggested or with respect to separate
mingw64 path from PATH env variable.

Solved!

fuck-msvc.png

If you want clang to default to mingw, it is easy to configure that way (-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-w64-mingw32 at cmake time). Or you can pass --target=x86_64-w64-mingw32 at runtime, and that will trigger mingw header search.

The upstream installer is built with MSVC, and LLVM targets whatever it was built with by default.

Reid, thanks for tip. I guess Clang 3.7 mislead me into thinking that
mingw headers should be searched by default since it works without
explicitly specifying mingw as the target.