瀏覽代碼

Dpkg::Shlibs: look into multi-arch paths when cross-building

The need for this was discovered when trying to bootstrap a
cross-toolchain against a multiarchified eglibc-source.

We should explicitly add the appropriate multiarch paths to our
library search path. These would be picked up later on anyway in the case
of a native build, but for, e.g., bootstrapping a cross-toolchain the
needed multiarch paths aren't going to be found in ld.so.conf.

Reported-by: Steve Langasek <steve.langasek@linaro.org>
Raphaël Hertzog 14 年之前
父節點
當前提交
9c523dd9ec
共有 2 個文件被更改,包括 12 次插入3 次删除
  1. 4 0
      debian/changelog
  2. 8 3
      scripts/Dpkg/Shlibs.pm

+ 4 - 0
debian/changelog

@@ -23,6 +23,10 @@ dpkg (1.16.2) UNRELEASED; urgency=low
     debian/control does not have any package stanza. Closes: #642473
     debian/control does not have any package stanza. Closes: #642473
     Based on a patch by Kyle Willmon <kylewillmon@gmail.com>.
     Based on a patch by Kyle Willmon <kylewillmon@gmail.com>.
 
 
+  [ Raphaël Hertzog ]
+  * Update Dpkg::Shlibs to look into multiarch paths when cross-building
+    too. Closes: #595144
+
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * Italian (Milo Casagrande). Closes: #627832
   * Italian (Milo Casagrande). Closes: #627832
 
 

+ 8 - 3
scripts/Dpkg/Shlibs.pm

@@ -29,7 +29,8 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::ErrorHandling;
 use Dpkg::Shlibs::Objdump;
 use Dpkg::Shlibs::Objdump;
 use Dpkg::Path qw(resolve_symlink canonpath);
 use Dpkg::Path qw(resolve_symlink canonpath);
-use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch);
+use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch
+                  gnutriplet_to_multiarch debarch_to_multiarch);
 
 
 use constant DEFAULT_LIBRARY_PATH =>
 use constant DEFAULT_LIBRARY_PATH =>
     qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
     qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
@@ -38,23 +39,27 @@ use constant DEFAULT_LIBRARY_PATH =>
 # Adjust set of directories to consider when we're in a situation of a
 # Adjust set of directories to consider when we're in a situation of a
 # cross-build or a build of a cross-compiler
 # cross-build or a build of a cross-compiler
 my @crosslibrarypaths;
 my @crosslibrarypaths;
-my $crossprefix;
+my ($crossprefix, $multiarch);
 # Detect cross compiler builds
 # Detect cross compiler builds
 if ($ENV{GCC_TARGET}) {
 if ($ENV{GCC_TARGET}) {
     $crossprefix = debarch_to_gnutriplet($ENV{GCC_TARGET});
     $crossprefix = debarch_to_gnutriplet($ENV{GCC_TARGET});
+    $multiarch = debarch_to_multiarch($ENV{GCC_TARGET});
 }
 }
 if ($ENV{DEB_TARGET_GNU_TYPE} and
 if ($ENV{DEB_TARGET_GNU_TYPE} and
     ($ENV{DEB_TARGET_GNU_TYPE} ne $ENV{DEB_BUILD_GNU_TYPE}))
     ($ENV{DEB_TARGET_GNU_TYPE} ne $ENV{DEB_BUILD_GNU_TYPE}))
 {
 {
     $crossprefix = $ENV{DEB_TARGET_GNU_TYPE};
     $crossprefix = $ENV{DEB_TARGET_GNU_TYPE};
+    $multiarch = gnutriplet_to_multiarch($ENV{DEB_TARGET_GNU_TYPE});
 }
 }
 # host for normal cross builds.
 # host for normal cross builds.
 if (get_build_arch() ne get_host_arch()) {
 if (get_build_arch() ne get_host_arch()) {
     $crossprefix = debarch_to_gnutriplet(get_host_arch());
     $crossprefix = debarch_to_gnutriplet(get_host_arch());
+    $multiarch = debarch_to_multiarch(get_host_arch());
 }
 }
 # Define list of directories containing crossbuilt libraries
 # Define list of directories containing crossbuilt libraries
 if ($crossprefix) {
 if ($crossprefix) {
-    push @crosslibrarypaths, "/$crossprefix/lib", "/usr/$crossprefix/lib",
+    push @crosslibrarypaths, "/lib/$multiarch", "/usr/lib/$multiarch",
+            "/$crossprefix/lib", "/usr/$crossprefix/lib",
             "/$crossprefix/lib32", "/usr/$crossprefix/lib32",
             "/$crossprefix/lib32", "/usr/$crossprefix/lib32",
             "/$crossprefix/lib64", "/usr/$crossprefix/lib64";
             "/$crossprefix/lib64", "/usr/$crossprefix/lib64";
 }
 }