clang++ broken by recent GCC update
RJVB
rjvbertin@gmail.com
Tue Dec 10 14:05:00 GMT 2013
jojelino <jojelino <at> gmail.com> writes:
> Clang does use hard-coded include path for using gcc header files.
> Please build your own or you can file bug report to clang.
>
Hardcoding header file locations isn't very clever, esp. if that means
things break even after applying a point update to gcc (4.7.3 to 4.7.x).
Below is a modified version of llvm's 3.1-cygwin-includes.patch that
attempts to address the issue for a certain time. Rather than relying on the
exact version/pathname, it assumes that someone will maintain a symlink as
is customary with shared libraries, e.g. (for current releases)
ln -s 4.8.2 /usr/lib/gcc/i686-pc-cygwin/4.8
Use setup.exe to get the llvm and clang sources and, most importantly,
llvm.cygport. Call cygport llvm.cygport prep inside /usr/src and interrupt
it when it starts patching. Replace the original includes.patch file with
the modified one, call cygport llvm.cygport all (or almostall) and go do
something else.
When this commands finishes, /usr/src/llvm-3.1-3/dist/llvm will contain all
llvm .tar.xz installer packages, which can be installed using
tar -C / -xJf package.tar.xz .
There doesn't appear to be any need to modify the libdirs.patch file.
What also surprises me is that cygwin is so much behind with llvm/clang
versions!
----------- cut : 3.1-cygwin-includes.patch
--- origsrc/llvm-3.1.src/tools/clang/lib/Frontend/InitHeaderSearch.cpp
2012-03-25 17:46:17.000000000 -0500
+++ src/llvm-3.1.src/tools/clang/lib/Frontend/InitHeaderSearch.cpp
2012-07-05 22:02:30.907716300 -0500
@@ -296,7 +296,7 @@ void InitHeaderSearch::AddDefaultCInclud
case llvm::Triple::RTEMS:
break;
case llvm::Triple::Cygwin:
- AddPath("/usr/include/w32api", System, true, false, false);
+ AddPath("/usr/lib/gcc/i686-pc-cygwin/4.5.3/include", System, true,
false, false);
break;
case llvm::Triple::MinGW32: {
// mingw-w64 crt include paths
@@ -321,6 +321,10 @@ void InitHeaderSearch::AddDefaultCInclud
if ( os != llvm::Triple::RTEMS )
AddPath("/usr/include", System, false, false, false);
+
+ /* some w32api headers collide (e.g. iODBC/ODBC32, Mesa/OpenGL) */
+ if ( os == llvm::Triple::Cygwin )
+ AddPath("/usr/include/w32api", System, true, false, false);
}
void InitHeaderSearch::
@@ -369,9 +373,6 @@ AddDefaultCPlusPlusIncludePaths(const ll
case llvm::Triple::Cygwin:
// Cygwin-1.7
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
"4.5.3");
- AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
"4.3.4");
- // g++-4 / Cygwin-1.5
- AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin",
"4.3.2");
break;
case llvm::Triple::MinGW32:
// mingw-w64 C++ include paths (i686-w64-mingw32 and x86_64-w64-
mingw32)
@@ -386,6 +387,7 @@ AddDefaultCPlusPlusIncludePaths(const ll
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.3");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0");
// mingw.org C++ include paths
+ AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-mingw32",
"4.5.3");
AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2");
//MSYS
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.6.2");
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.6.1");
--- origsrc/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-11
19:16:02.000000000 -0500
+++ src/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-07-04
23:51:09.272480100 -0500
@@ -2288,7 +2290,7 @@ void Linux::AddClangCXXStdlibIncludeArgs
DriverArgs, CC1Args)) {
// Gentoo is weird and places its headers inside the GCC install, so if
the
// first attempt to find the headers fails, try this pattern.
- addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4",
+ addLibStdCXXIncludePaths(InstallDir + "/include/c++",
(GCCInstallation.getTriple().str() +
GCCInstallation.getMultiarchSuffix()),
DriverArgs, CC1Args);
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list