Source: llvm-toolchain-8
Version: 1:8.0.1-3
Severity: important
Tags: ftbfs
Justification: fails to build from source, but built in the past, on d-ports 
arch


One of the build errors is caused by you dropping a patch that,
according to d/changelog in llvm-toolchain-8, was pertinent in
both llvm-toolchain-7 (which DID at one time build) and -snapshot.

I’m attaching the patch and am currently building it locally to
see whether this was all or whether more is needed. The patch only
needed minor updating.

This almost certainly also applies to llvm-toolchain-9, do you
prefer a separate bugreport there?
diff -Nru llvm-toolchain-8-8.0.1/debian/changelog 
llvm-toolchain-8-8.0.1/debian/changelog
--- llvm-toolchain-8-8.0.1/debian/changelog     2019-08-07 15:11:36.000000000 
+0200
+++ llvm-toolchain-8-8.0.1/debian/changelog     2019-10-05 23:48:41.000000000 
+0200
@@ -1,3 +1,10 @@
+llvm-toolchain-8 (1:8.0.1-3+x32.1) unreleased; urgency=high
+
+  * Non-maintainer upload.
+  * Add back cbmuser’s patch to fix include and library paths on x32
+
+ -- Thorsten Glaser <t...@mirbsd.de>  Sat, 05 Oct 2019 23:48:41 +0200
+
 llvm-toolchain-8 (1:8.0.1-3) unstable; urgency=medium
 
   * llvm-tools: depend on python2 packages too, the move to python3 was
diff -Nru llvm-toolchain-8-8.0.1/debian/patches/series 
llvm-toolchain-8-8.0.1/debian/patches/series
--- llvm-toolchain-8-8.0.1/debian/patches/series        2019-08-06 
09:36:11.000000000 +0200
+++ llvm-toolchain-8-8.0.1/debian/patches/series        2019-10-05 
23:46:48.000000000 +0200
@@ -138,3 +138,6 @@
 
 # Python 3
 0050-Remove-explicit-python-version-list.patch
+
+# porting
+x32-fix-driver-search-paths.diff
diff -Nru 
llvm-toolchain-8-8.0.1/debian/patches/x32-fix-driver-search-paths.diff 
llvm-toolchain-8-8.0.1/debian/patches/x32-fix-driver-search-paths.diff
--- llvm-toolchain-8-8.0.1/debian/patches/x32-fix-driver-search-paths.diff      
1970-01-01 01:00:00.000000000 +0100
+++ llvm-toolchain-8-8.0.1/debian/patches/x32-fix-driver-search-paths.diff      
2019-10-05 23:48:22.000000000 +0200
@@ -0,0 +1,80 @@
+Description: Fix missing include and library paths on x32
+Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de>
+Forwarded: https://reviews.llvm.org/D52050
+Last-Update: 2019-10-05
+
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -1916,7 +1916,10 @@ void Generic_GCC::GCCInstallationDetecto
+       "x86_64-slackware-linux", "x86_64-unknown-linux",
+       "x86_64-amazon-linux",    "x86_64-linux-android",
+       "x86_64-kfreebsd-gnu",    "x86_64-pc-kfreebsd-gnu"};
+-  static const char *const X32LibDirs[] = {"/libx32"};
++  static const char *const X32LibDirs[] = {"/libx32", "/lib"};
++  static const char *const X32Triples[] = {
++      "x86_64-linux-gnux32",    "x86_64-unknown-linux-gnux32",
++      "x86_64-pc-linux-gnux32"};
+   static const char *const X86LibDirs[] = {"/lib32", "/lib"};
+   static const char *const X86Triples[] = {
+       "i686-linux-gnu",       "i686-pc-linux-gnu",     "i486-linux-gnu",
+@@ -2127,14 +2130,16 @@ void Generic_GCC::GCCInstallationDetecto
+     }
+     break;
+   case llvm::Triple::x86_64:
+-    LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+-    TripleAliases.append(begin(X86_64Triples), end(X86_64Triples));
+     // x32 is always available when x86_64 is available, so adding it as
+     // secondary arch with x86_64 triples
+     if (TargetTriple.getEnvironment() == llvm::Triple::GNUX32) {
+-      BiarchLibDirs.append(begin(X32LibDirs), end(X32LibDirs));
++      LibDirs.append(begin(X32LibDirs), end(X32LibDirs));
++      TripleAliases.append(begin(X32Triples), end(X32Triples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+       BiarchTripleAliases.append(begin(X86_64Triples), end(X86_64Triples));
+     } else {
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64Triples), end(X86_64Triples));
+       BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
+       BiarchTripleAliases.append(begin(X86Triples), end(X86Triples));
+     }
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -88,10 +88,13 @@ static std::string getMultiarchTriple(co
+   case llvm::Triple::x86_64:
+     if (IsAndroid)
+       return "x86_64-linux-android";
+-    // We don't want this for x32, otherwise it will match x86_64 libs
+-    if (TargetEnvironment != llvm::Triple::GNUX32 &&
+-        D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
+-      return "x86_64-linux-gnu";
++    if (TargetEnvironment == llvm::Triple::GNUX32) {
++      if (D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnux32"))
++        return "x86_64-linux-gnux32";
++    } else {
++      if (D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
++        return "x86_64-linux-gnu";
++    }
+     break;
+   case llvm::Triple::aarch64:
+     if (IsAndroid)
+@@ -702,6 +705,8 @@ void Linux::AddClangSystemIncludeArgs(co
+       // in use in any released version of Debian, so we should consider
+       // removing them.
+       "/usr/include/i686-linux-gnu/64", "/usr/include/i486-linux-gnu/64"};
++  const StringRef X32MultiarchIncludeDirs[] = {
++      "/usr/include/x86_64-linux-gnux32"};
+   const StringRef X86MultiarchIncludeDirs[] = {
+       "/usr/include/i386-linux-gnu",
+ 
+@@ -759,7 +764,10 @@ void Linux::AddClangSystemIncludeArgs(co
+   ArrayRef<StringRef> MultiarchIncludeDirs;
+   switch (getTriple().getArch()) {
+   case llvm::Triple::x86_64:
+-    MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
++    if (getTriple().getEnvironment() == llvm::Triple::GNUX32)
++      MultiarchIncludeDirs = X32MultiarchIncludeDirs;
++    else
++      MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
+     break;
+   case llvm::Triple::x86:
+     MultiarchIncludeDirs = X86MultiarchIncludeDirs;

Reply via email to