Hopefully, this patch works. It is against clang-2.9-1, not sure I got the changelog right, though. Anybody got a suggestion how to test the include-paths thoroughly? What packages could I build that exercise them exhaustively, especially the recent Debian-specifics?
Michael
diff -Nru clang-2.9/debian/changelog clang-2.9/debian/changelog --- clang-2.9/debian/changelog 2011-05-26 10:10:34.000000000 +0000 +++ clang-2.9/debian/changelog 2011-05-28 16:29:38.000000000 +0000 @@ -1,3 +1,14 @@ +clang (2.9-1.1) unstable; urgency=low + + * Non-maintainer upload. + * debian/control: binutils-dev added as dependency of clang + * debian/patches/searchGCCPath.patch: Remove Ubuntu-specifics + * debian/rules: Pass include-paths at configure-time such that the broken + automatic searching is disabled (see + http://llvm.org/bugs/show_bug.cgi?id=6907) + + -- Michael Wild <them...@users.sourceforge.net> Sat, 28 May 2011 16:24:57 +0200 + clang (2.9-1) unstable; urgency=low * debian/packages.d/tools.mk: clang C++ headers detection was broken. Set them diff -Nru clang-2.9/debian/control clang-2.9/debian/control --- clang-2.9/debian/control 2011-05-26 23:36:48.000000000 +0000 +++ clang-2.9/debian/control 2011-05-28 16:30:02.000000000 +0000 @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 6.0.0), flex, bison, dejagnu, tcl8.5, expect, autoconf, automake1.9, perl, libtool, doxygen, chrpath, texinfo, sharutils, autotools-dev (>= 20060702.1), libffi-dev (>= 3.0.9), - lsb-release, patchutils, diffstat, xz-utils, llvm-2.9-dev (>= 2.9), llvm-2.9-source (>= 2.9) + lsb-release, patchutils, diffstat, xz-utils, binutils-dev,, llvm-2.9-dev (>= 2.9), llvm-2.9-source (>= 2.9) Build-Conflicts: oprofile, ocaml, ocaml-nox Standards-Version: 3.9.2 Homepage: http://www.llvm.org/ diff -Nru clang-2.9/debian/control.in/source clang-2.9/debian/control.in/source --- clang-2.9/debian/control.in/source 2011-04-12 08:17:29.000000000 +0000 +++ clang-2.9/debian/control.in/source 2011-05-28 16:22:33.000000000 +0000 @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 6.0.0), flex, bison, dejagnu, tcl8.5, expect, autoconf, automake1.9, perl, libtool, doxygen, chrpath, texinfo, sharutils, autotools-dev (>= 20060702.1), libffi-dev (>= 3.0.9), - lsb-release, patchutils, diffstat, xz-utils @BUILDDEPS@ + lsb-release, patchutils, diffstat, xz-utils, binutils-dev, @BUILDDEPS@ Build-Conflicts: oprofile @BUILDCONFLICTS@ Standards-Version: 3.9.2 Homepage: http://www.llvm.org/ diff -Nru clang-2.9/debian/patches/searchGCCPath.patch clang-2.9/debian/patches/searchGCCPath.patch --- clang-2.9/debian/patches/searchGCCPath.patch 2011-05-26 23:36:48.000000000 +0000 +++ clang-2.9/debian/patches/searchGCCPath.patch 2011-05-28 16:30:02.000000000 +0000 @@ -1,27 +1,28 @@ --- - InitHeaderSearch.cpp | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) + ToolChains.cpp | 8 ++++++++ + 1 file changed, 8 insertions(+) ---- clang-2.9.orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp 2011-03-22 01:24:04.000000000 +0100 -+++ clang-2.9/tools/clang/lib/Frontend/InitHeaderSearch.cpp 2011-05-26 12:08:48.000000000 +0200 -@@ -643,6 +643,20 @@ - // Debian based distros. - // Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y - //===------------------------------------------------------------------===// -+ // Debian -- gcc-4.5.X -+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.2", -+ "x86_64-linux-gnu", "32", "", triple); -+ -+ // Ubuntu 11.04 "Natty Narwhal" -- gcc-4.5.2 -+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", -+ "x86_64-linux-gnu", "32", "", triple); -+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", -+ "i686-linux-gnu", "", "64", triple); -+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", -+ "i486-linux-gnu", "", "64", triple); -+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", -+ "arm-linux-gnueabi", "", "", triple); -+ - // Ubuntu 10.10 "Maverick Meerkat" -- gcc-4.4.5 - AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", - "i686-linux-gnu", "", "64", triple); +--- clang-2.9.orig/tools/clang/lib/Driver/ToolChains.cpp ++++ clang-2.9/tools/clang/lib/Driver/ToolChains.cpp +@@ -1432,6 +1432,9 @@ Linux::Linux(const HostInfo &Host, const + else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-manbo-linux-gnu", + Exists) && Exists) + GccTriple = "x86_64-manbo-linux-gnu"; ++ else if (!llvm::sys::fs::exists("/usr/lib/x86_64-linux-gnu/gcc", ++ Exists) && Exists) ++ GccTriple = "x86_64-linux-gnu"; + } else if (Arch == llvm::Triple::x86) { + if (!llvm::sys::fs::exists("/usr/lib/gcc/i686-linux-gnu", Exists) && Exists) + GccTriple = "i686-linux-gnu"; +@@ -1463,6 +1466,11 @@ Linux::Linux(const HostInfo &Host, const + Base = t2; + break; + } ++ std::string t3 = "/usr/lib/" + GccTriple + "/gcc/" + Suffix; ++ if (!llvm::sys::fs::exists(t3 + "/crtbegin.o", Exists) && Exists) { ++ Base = t3; ++ break; ++ } + } + + path_list &Paths = getFilePaths(); diff -Nru clang-2.9/debian/rules.d/vars.mk clang-2.9/debian/rules.d/vars.mk --- clang-2.9/debian/rules.d/vars.mk 2011-05-26 09:42:18.000000000 +0000 +++ clang-2.9/debian/rules.d/vars.mk 2011-05-28 15:46:08.000000000 +0000 @@ -68,6 +68,11 @@ confargs := \ CC=$(DEB_HOST_GNU_TYPE)-gcc CXX=$(DEB_HOST_GNU_TYPE)-g++ \ CPP=$(DEB_HOST_GNU_TYPE)-cpp \ + --with-c-include-dirs=/usr/include/$(DEB_HOST_GNU_TYPE):/usr/include \ + --with-cxx-include-root=/usr/include/c++/4.5 \ + --with-cxx-include-arch=$(DEB_HOST_GNU_TYPE) \ + --with-cxx-include-32bit-dir=32 \ + --with-binutils-include=/usr/include --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) # build not yet prepared to take variables from the environment