From: Rafael Espindola Date: Wed, 28 Aug 2013 23:17:47 +0000 (+0000) Subject: Look for libstdc++ first on the clang install directory. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69ca5e263feb5d231a81bbd28f96bca6a630bd50;p=clang Look for libstdc++ first on the clang install directory. When sysroot is not set, look for libstdc++ first on the clang install directory. Before this change if clang was installed alongside a gcc with the same version as the system one we would select the system libstdc++. Unfortunately this is hard to test as only the non-sysroot case is changed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189536 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 58847c8aac..7025a9931f 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1021,9 +1021,18 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( Prefixes.push_back(GCCToolchainDir); } else { - Prefixes.push_back(D.SysRoot); - Prefixes.push_back(D.SysRoot + "/usr"); + // If we have a SysRoot, try that first. + if (!D.SysRoot.empty()) { + Prefixes.push_back(D.SysRoot); + Prefixes.push_back(D.SysRoot + "/usr"); + } + + // Then look for gcc installed alongside clang. Prefixes.push_back(D.InstalledDir + "/.."); + + // And finally in /usr. + if (D.SysRoot.empty()) + Prefixes.push_back("/usr"); } // Loop over the various components which exist and select the best GCC