[cfe-dev] Mingw-builds mingw-w64 include directories

Johan Engelen jbc.engelen at swissonline.ch
Thu May 22 15:56:30 PDT 2014


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

-------------- next part --------------
Index: lib/Frontend/InitHeaderSearch.cpp
===================================================================
--- lib/Frontend/InitHeaderSearch.cpp	(revision 209477)
+++ lib/Frontend/InitHeaderSearch.cpp	(working copy)
@@ -411,6 +411,13 @@
       AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.0");
       AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.1");
       AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.8.2");
+      // <sysroot>/x86_64-w64-mingw32/include/c++/...
+      AddPath(HSOpts.ResourceDir + "/../../../x86_64-w64-mingw32/include/c++",
+              CXXSystem, false);
+      AddPath(HSOpts.ResourceDir + "/../../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32",
+              CXXSystem, false);
+      AddPath(HSOpts.ResourceDir + "/../../../x86_64-w64-mingw32/include/c++/backward",
+              CXXSystem, false);
       // mingw.org C++ include paths
 #if defined(LLVM_ON_WIN32)
       AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.7.0");


More information about the cfe-dev mailing list