[cfe-dev] llvm can't use headers from gcc 4.4 on centos Linux x86

NAKAMURA Takumi geek4civic at gmail.com
Thu Oct 28 19:30:02 PDT 2010


Good morning, Richard.

The patch for MC/MachO has been committed in r117637.

  Expected Passes    : 7620
  Expected Failures  : 59
  Unsupported Tests  : 555

My comments are below inline;

2010/10/29 Richard Spillane <necro351 at gmail.com>:
> OK, thanks.  Also I forgot to include the AddPaths for the C search,
> here is the updated patch.  Also its for CentOS 5.5, not 5.3:
>
> crossroads$ svn diff
> Index: lib/Frontend/InitHeaderSearch.cpp
> ===================================================================
> --- lib/Frontend/InitHeaderSearch.cpp   (revision 117545)
> +++ lib/Frontend/InitHeaderSearch.cpp   (working copy)
> @@ -418,7 +418,13 @@
>  void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
>                                             const HeaderSearchOptions
> &HSOpts) {
> +  AddPath("/usr/include/c++/4.4.0", System, true, false, false);
> +  AddPath("/usr/include/c++/4.4.0/x86_64-redhat-linux6E", System,
> true, false, false);
> +  AddPath("/usr/include/c++/4.4.0/backward", System, true, false, false);

You don't have to include C++ dirs here :)

> +  AddPath("/usr/lib/gcc/x86_64-redhat-linux6E/4.4.0/include", System,
> true, false, false);

It should be avoided. Clang has its alternatives.
It can be assumed as "gcc-44 specific headers".


> @@ -645,6 +651,13 @@
>     //===------------------------------------------------------------------===//
>     // Redhat based distros.
>     //===------------------------------------------------------------------===//
> +    // Centos 5.3
> +    AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.0","", "", "", triple);
> +    AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.0/x86_64-redhat-linux6E","",
> "", "", triple);
> +    AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.0/backward","",
> "", "", triple);
> +    AddGnuCPlusPlusIncludePaths("/usr/local/include","", "", "", triple);
> +    AddGnuCPlusPlusIncludePaths("/usr/lib/gcc/x86_64-redhat-linux6E/4.4.0/include","",
> "", "", triple);

It's bad and redundant. Please see the implementation of
InitHeaderSearch::AddGnuCPlusPlusIncludePaths().

FYI this is my local patch.
You might also add "g++44" to lib/Driver/Driver.cpp.

--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -664,6 +664,12 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple)
                                 "x86_64-redhat-linux", "32", "", triple);
     AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
                                 "i586-redhat-linux","", "", triple);
+    // CentOS5(gcc44)
+#if __GNUC__ == 4 && __GNUC_MINOR__ == 4
+    AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.0",
+                                "x86_64-redhat-linux6E", "32", "", triple);
+#endif
+
     // Fedora 10
     AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
                                 "x86_64-redhat-linux", "32", "", triple);


...Takumi




More information about the cfe-dev mailing list