Sorry Sandeep,<br><br>I dont understand. What is your platform? Is it Darwin OS? Why you are using MinGW?<br>The patch only applies to Windows with MinGW.<br>Currently, the parameter "Arch" is hardcoded. I just want to obtain it at the ./configure process.<br>
<br>An alternative solution would be in compilation process, clang executes "g++ -dumpmachine" and get it in run-time.<br><br>Regards,<br>Fernando.<br><br><div class="gmail_quote">On Tue, Aug 31, 2010 at 5:40 PM, Sandeep Patel <span dir="ltr"><<a href="mailto:deeppatel1987@gmail.com">deeppatel1987@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">This only works if the build == host.<br>
<br>
I routinely build with build = darwin, host = mingw. I don't use CMake either.<br>
<br>
If you can improve the search paths, that would be great, but please<br>
bear in mind that your build approach isn't the only one.<br>
<br>
deep<br>
<div><div></div><div class="h5"><br>
On Tue, Aug 31, 2010 at 1:50 PM, Fernando Pelliccioni<br>
<<a href="mailto:fpelliccioni@gmail.com">fpelliccioni@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I found a problem and I am writing to propose a solution, I would like to<br>
> know what you think.<br>
> I am working on Win32 with MinGW (GCC 4.4)<br>
><br>
> I quote an extract of the InitHeaderSearch class (<br>
> /tools/clang/lib/Frontend/InitHeaderSearch.cpp )<br>
><br>
> //----------------------------------------------------------------------------------------------------<br>
><br>
> void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base,<br>
> llvm::StringRef Arch,<br>
> llvm::StringRef<br>
> Version) {<br>
><br>
> AddPath(Base + "/" + Arch + "/" + Version + "/include",<br>
> System, true, false, false);<br>
> AddPath(Base + "/" + Arch + "/" + Version + "/include/c++",<br>
> System, true, false, false);<br>
> AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/backward",<br>
> System, true, false, false);<br>
> }<br>
><br>
> void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(const llvm::Triple<br>
> &triple) {<br>
> //...<br>
> case llvm::Triple::MinGW64:<br>
> // Try gcc 4.4.0<br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0");<br>
> // Try gcc 4.3.0<br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0");<br>
> // Fall through.<br>
> case llvm::Triple::MinGW32:<br>
> // Try gcc 4.4.0<br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");<br>
> // Try gcc 4.3.0<br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");<br>
> break;<br>
> //...<br>
> }<br>
><br>
> //----------------------------------------------------------------------------------------------------<br>
><br>
> For example, in this line ...<br>
><br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");<br>
><br>
> ... "mingw32" corresponds to the parameter "Arch" of function<br>
> "AddMinGWCPlusPlusIncludePaths". It is harcoded!<br>
><br>
><br>
> In GCC, if I want to know what is the Header Seach Path, I can run ...<br>
><br>
> > g++ -v -c xxx.cpp<br>
><br>
> ...<br>
> #include "..." search starts here:<br>
> #include <...> search starts here:<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/mingw32<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/backward<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include-fixed<br>
> c:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../mingw32/include<br>
> End of search list.<br>
> ...<br>
><br>
><br>
> I tried another implementation of MinGW (GCC 4.6) in which I got X.<br>
><br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/include/c++<br>
><br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/include/c++/i686-pc-mingw32<br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/include/c++/backward<br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../include<br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/include<br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/include-fixed<br>
><br>
> c:\mingw\bin\../lib/gcc/i686-pc-mingw32/4.6.0/../../../../i686-pc-mingw32/include<br>
><br>
><br>
> The problem is in the "Arch" parameter, in one implementation I have<br>
> "mingw32" and in the other "i686-pc-mingw32"<br>
><br>
> How I can know which parameter to use?<br>
><br>
> The answer is...<br>
><br>
> > g++ -dumpmachine<br>
> mingw32<br>
><br>
> or in the second MinGW implementation...<br>
><br>
> > g++ -dumpmachine<br>
> i686-pc-mingw32<br>
><br>
><br>
> To fix this, I propose to add a new preprocessor #define on "config.h" and<br>
> "llvm-config.h", like the following...<br>
><br>
> #define LLVM_MINGW_DUMPMACHINE "mingw32"<br>
><br>
> LLVM_MINGW_DUMPMACHINE is fed in the CMake configuration phase, and can be<br>
> used in the InitHeaderSearch class as follows...<br>
><br>
> AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc",<br>
> llvm::StringRef(LLVM_MINGW_DUMPMACHINE), "4.4.0");<br>
><br>
><br>
> The files involved are:<br>
><br>
> /cmake/config-ix.cmake<br>
> /cmake/modules/GetTargetTriple.cmake<br>
> /include/llvm/Config/config.h.cmake<br>
> /include/llvm/Config/llvm-config.h.cmake<br>
> /include/llvm/Config/<a href="http://config.h.in" target="_blank">config.h.in</a><br>
> /include/llvm/Config/<a href="http://llvm-config.h.in" target="_blank">llvm-config.h.in</a><br>
> /tools/clang/lib/Frontend/InitHeaderSearch.cpp<br>
><br>
><br>
><br>
> I want to know what do you think about this solution. If you approve, I will<br>
> send the patches.<br>
><br>
> The next step is to avoid the hardcoding of "c:/MinGW/lib/gcc"...<br>
><br>
><br>
> Thanks and Regards.<br>
> Fernando Pelliccioni.<br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
><br>
</blockquote></div><br>