Some distros with ten years of support ship an old gcc but later offer more recent versions for installation in parallel. These versions are typically not only needed for the compilation of llvm/clang, but also to properly use the clang binary that comes out.

Clang already searches /usr at runtime for the most recent installation of gcc. This patch appends paths for add-on installations of gcc in RHEL.

--- a/tools/clang/lib/Driver/ToolChains.cpp     2014-08-27
22:07:31.000000000 +0200
+++ b/tools/clang/lib/Driver/ToolChains.cpp     2014-09-08
02:51:38.197987523 +0200
@@ -1249,8 +1249,14 @@
     Prefixes.push_back(D.InstalledDir + "/..");
 
     // And finally in /usr.
-    if (D.SysRoot.empty())
+    if (D.SysRoot.empty()) {
+      Prefixes.push_back("/opt/rh/devtoolset-4/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-3/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-2/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-1.1/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-1.0/root/usr");
       Prefixes.push_back("/usr");
+    }
   }
 
   // Loop over the various components which exist and select the best GCC
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to