On 06/01/2011 06:42 PM, Sylvestre Ledru wrote:
> Le mercredi 01 juin 2011 à 08:30 +0200, Michael Wild a écrit :
>> Sylvestre,
> 
>> Are you, by any chance, building on i686?
> I confirm that it is working with my x86_64 system.
> Did you look on how to fix that ?
> 
> S
> 

The error you saw was due to the fact that clang doesn't know about
wheezy/sid, and thus didn't identify it as a Debian distro.

Could you give attached patch a shot? It works in my cowbuilder chroots
for both i386 and amd64, using up-to-date wheezy/sid. On both
architectures I can generate 32 and 64-bit binaries.
Thanks

Michael

diff -Nru clang-2.9/debian/changelog clang-2.9/debian/changelog
--- clang-2.9/debian/changelog	2011-05-26 12:10:34.000000000 +0200
+++ clang-2.9/debian/changelog	2011-06-02 13:15:46.000000000 +0200
@@ -1,3 +1,15 @@
+clang (2.9-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/patches/searchGCCPath.patch: Remove because it is Ubuntu-specific
+  * debian/patches/handleWheezySid.patch: Introduce Debian wheezy/sid to Clang
+  * 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). Only specify 32/64-bit
+    include-dir suffix on 32/64-bit architectures.
+
+ -- Michael Wild <them...@users.sourceforge.net>  Thu, 02 Jun 2011 13:14:51 +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/patches/handleWheezySid.patch clang-2.9/debian/patches/handleWheezySid.patch
--- clang-2.9/debian/patches/handleWheezySid.patch	1970-01-01 01:00:00.000000000 +0100
+++ clang-2.9/debian/patches/handleWheezySid.patch	2011-06-02 13:16:01.000000000 +0200
@@ -0,0 +1,58 @@
+---
+ ToolChains.cpp |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+Description: Introduce wheezy/sid to clang
+ Add detection for Debian wheezy/sid in lib/Driver/ToolChains.cpp
+
+Author: Michael Wild <them...@users.sourceforge.net>
+Bug: http://llvm.org/bugs/show_bug.cgi?id=10064
+Forwarded: http://llvm.org/bugs/attachment.cgi?id=6674
+Last-Update: 2011-06-02
+
+--- clang-2.9.orig/tools/clang/lib/Driver/ToolChains.cpp
++++ clang-2.9/tools/clang/lib/Driver/ToolChains.cpp
+@@ -30,6 +30,7 @@
+ #include "llvm/Support/system_error.h"
+ 
+ #include <cstdlib> // ::getenv
++#include <iostream>
+ 
+ using namespace clang::driver;
+ using namespace clang::driver::toolchains;
+@@ -1276,6 +1277,7 @@ enum LinuxDistro {
+   ArchLinux,
+   DebianLenny,
+   DebianSqueeze,
++  DebianWheezy,
+   Exherbo,
+   Fedora13,
+   Fedora14,
+@@ -1298,7 +1300,8 @@ static bool IsOpenSuse(enum LinuxDistro
+ }
+ 
+ static bool IsDebian(enum LinuxDistro Distro) {
+-  return Distro == DebianLenny || Distro == DebianSqueeze;
++  return Distro == DebianLenny || Distro == DebianSqueeze ||
++         Distro == DebianWheezy;
+ }
+ 
+ static bool IsUbuntu(enum LinuxDistro Distro) {
+@@ -1363,6 +1366,8 @@ static LinuxDistro DetectLinuxDistro(llv
+       return DebianLenny;
+     else if (Data.startswith("squeeze/sid"))
+       return DebianSqueeze;
++    else if (Data.startswith("wheezy/sid"))
++      return DebianWheezy;
+     return UnknownDistro;
+   }
+ 
+@@ -1510,7 +1515,7 @@ Linux::Linux(const HostInfo &Host, const
+ 
+   if (Distro == DebianSqueeze || IsOpenSuse(Distro) ||
+       IsFedora(Distro) || Distro == UbuntuLucid || Distro == UbuntuMaverick ||
+-      Distro == UbuntuKarmic)
++      Distro == UbuntuKarmic || Distro == DebianWheezy)
+     ExtraOpts.push_back("--build-id");
+ 
+   if (Distro == ArchLinux)
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-27 12:04:10.000000000 +0200
+++ clang-2.9/debian/patches/searchGCCPath.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,27 +0,0 @@
----
- InitHeaderSearch.cpp |   14 ++++++++++++++
- 1 file changed, 14 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);
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 11:42:18.000000000 +0200
+++ clang-2.9/debian/rules.d/vars.mk	2011-06-01 15:51:04.000000000 +0200
@@ -68,8 +68,17 @@
 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) \
 	--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE)
 
+ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH_BITS),64)
+  confargs += --with-cxx-include-32bit-dir=32
+else
+  confargs += --with-cxx-include-64bit-dir=64
+endif
+
 # build not yet prepared to take variables from the environment
 define unsetenv
   unexport $(1)

Reply via email to