[cfe-dev] Clang crtbegin.o not found

NAKAMURA Takumi geek4civic at gmail.com
Mon Mar 7 17:32:54 PST 2011


Greg,

ToT clang would not be familiar to centos-5.
To compile C++ projects, you would feel messy for incompatibility of
libstdc++-4.1.

You may tweak as below;

  - install "gcc44" and "gcc44-c++".
  - better to use CC=gcc44 CXX=g++44 to build clang and llvm.
  - Tweak lib/Driver/ToolChains.cpp to let gcc44 detected,
""/usr/lib/gcc/x86_64-redhat-linux6E".
  - Tweak lib/FrontEnd/InitHeaderSearch.cpp to add
"/usr/include/c++/4.4.0" and "x86_64-redhat-linux6E".
  - Tweak lib/Driver/Driver.cpp to force use g++44.

Here is one of my local patches. I won't commit it because it would be
too ad-hoc.

...Takumi
-------------- next part --------------
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 572323a..0926747 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -241,6 +241,8 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) {
   if (CCCIsCXX) {
 #ifdef IS_CYGWIN15
     CCCGenericGCCName = "g++-4";
+#elif defined(__linux__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
+    CCCGenericGCCName = "g++44";	// CentOS5
 #else
     CCCGenericGCCName = "g++";
 #endif
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 7cae9ba..6df7aea 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1416,6 +1416,9 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
     else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-pc-linux-gnu",
              Exists) && Exists)
       GccTriple = "x86_64-pc-linux-gnu";
+    else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-redhat-linux6E",
+             Exists) && Exists)
+      GccTriple = "x86_64-redhat-linux6E";
     else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-redhat-linux",
              Exists) && Exists)
       GccTriple = "x86_64-redhat-linux";
@@ -1443,7 +1446,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
   }
 
   const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4",
-                               "4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2",
+                               "4.4.3", "4.4.0", "4.4", "4.3.4", "4.3.3", "4.3.2",
                                "4.3"};
   std::string Base = "";
   for (unsigned i = 0; i < sizeof(GccVersions)/sizeof(char*); ++i) {
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index cae006a..ad663b4 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -697,6 +697,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 defined(__linux__) && __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);


More information about the cfe-dev mailing list