[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Dpkg/Shlibs.pm: multiarch search paths



Hi guys,

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



We should explicitly prepend 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.

---
 debian/changelog       |    5 +++++
 scripts/Dpkg/Shlibs.pm |   13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2d0883c..67fbae1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -104,6 +104,11 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     DEB_BUILD_MULTIARCH, that return the "ideal" GNU triplet for each
     architecture which should be used as the path component for library
     installation.
+  * Dpkg/Shlibs.pm: we should explicitly prepend 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.
 
   [ Updated programs translations ]
   * German (Sven Joachim).
diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm
index 95ef4fe..95950e1 100644
--- a/scripts/Dpkg/Shlibs.pm
+++ b/scripts/Dpkg/Shlibs.pm
@@ -29,7 +29,8 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Shlibs::Objdump;
 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 debarch_to_multiarch
+                  get_build_arch get_host_arch);
 
 use constant DEFAULT_LIBRARY_PATH =>
     qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
@@ -39,6 +40,10 @@ use constant DEFAULT_LIBRARY_PATH =>
 # cross-build or a build of a cross-compiler
 my @crosslibrarypaths;
 my $crossprefix;
+# And when we're not building a cross-compiler, be sure to pick up the
+# multiarch paths
+my @multiarchpaths;
+my $multiarch;
 # Detect cross compiler builds
 if ($ENV{GCC_TARGET}) {
     $crossprefix = debarch_to_gnutriplet($ENV{GCC_TARGET});
@@ -51,6 +56,7 @@ if ($ENV{DEB_TARGET_GNU_TYPE} and
 # host for normal cross builds.
 if (get_build_arch() ne get_host_arch()) {
     $crossprefix = debarch_to_gnutriplet(get_host_arch());
+    $multiarch = debarch_to_multiarch(get_host_arch());
 }
 # Define list of directories containing crossbuilt libraries
 if ($crossprefix) {
@@ -58,8 +64,11 @@ if ($crossprefix) {
             "/$crossprefix/lib32", "/usr/$crossprefix/lib32",
             "/$crossprefix/lib64", "/usr/$crossprefix/lib64";
 }
+if ($multiarch) {
+    push @multiarchpaths, "/lib/$multiarch", "/usr/lib/$multiarch";
+}
 
-our @librarypaths = (DEFAULT_LIBRARY_PATH, @crosslibrarypaths);
+our @librarypaths = (@multiarchpaths, DEFAULT_LIBRARY_PATH, @crosslibrarypaths);
 
 # Update library paths with LD_LIBRARY_PATH
 if ($ENV{LD_LIBRARY_PATH}) {
-- 
1.7.1


Reply to: