Mingw-builds mingw-w64 include directories

Hello all,
   To make clang++ work (easily) with the latest mingw-w64 builds by the Mingw-build project, I added more paths to the search for default include directories, and it works splendid. See the attached patch.
In short, the issue is that clang is searching for versioned paths, but (at least for the package with gcc4.9.0) the C++ include paths aren't versioned. For example, right now, clang is searching for
   [...]/include/c++/4.8.0
while really this folder is
   [...]/x86_64-w64-mingw32/include/c++

Are you happy to add the following paths to the default list?
<sysroot>/x86_64-w64-mingw32/include/c++/
<sysroot>/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32
<sysroot>/x86_64-w64-mingw32/include/c++/backward
<sysroot>/i686-w64-mingw32/include/c++/
<sysroot>/i686-w64-mingw32/include/c++/i686-w64-mingw32
<sysroot>/i686-w64-mingw32/include/c++/backward
(the final 3 are a guess, judging from the symmetry in the pathnames that clang already searches for)
This assumes gcc and clang are in <sysroot>/bin.
I believe it will make life much easier for Windows developers who want to give clang a spin.

If so, I will clean up the modifications and submit it for review.

Thanks,
   Johan

InitHeaderSearch.cpp.patch (981 Bytes)

Hi Johan, I think that we’re trying to move away from logic in InitHeaderSearch. The idea is to implement MinGW toolchain and the same way we have Windows, GCC and other toolchains. Last thing I heard Ruben was working on this (+CC)

Search for thread titled “Clang and (cross-)compilation to [i686, x86_64]-w64-mingw32” on the mailing list for more info.

Hi Johan,

The Driver merge request is located here:
http://reviews.llvm.org/D3420

It was not submitted by me, but has seen little activity lately :frowning: I would say the patch more or less applies cleanly and should work, although I myself haven’t taken a very close look at the modifications. Try it out, and let us know if something doesn’t work. I wrote the original Driver code based on a personal GCC build (with default options) and the Arch MinGW-w64 cross toolchain. So your mileage may vary.

Ruben

Hi Ruben,
It took a while but I finally looked at the patch. It almost works. :slight_smile:
It applies cleanly and compiles fine. But it does not search/find the correct folders (for the MinGW-W64-builds download at least). The C++ search paths do not include the GCC version in that package, in contrast to what the mingw driver patch is searching for.

I have added code to the merge request that makes it work for me.
Please have a look. I am not familiar with how to properly modify the merge request. Thanks for the trouble. Again, it would be great if the next release would have easier support for mingw64. Johan