Hi Helmut, On Tue, 03 Jan 2017, Helmut Grohne wrote: > No, because using binutils-multiarch is broken. Whenever a new > architecture is brought up, binutils-multiarch lacks support for it.
Ok, that makes sense. > > That would let us use objdump to inspect any library and let > > dpkg-shlibdeps figure out whether it's a library of the correct > > architecture or not. > > Inspecting those objects is a bug in the first place. You are trying to > work around it again rather than fixing it properly. I admit that it is > non-trivial to fix as it is deeply rooted in glibc. dpkg-shlibdeps > inherits it by parsing /etc/ld.so.conf.d. I don't think it's wrong... we are trying to behave like ld.so and I guess that ld.so does check whether the library is built for the same architecture. It's just that the way dpkg-shlibdeps uses to make the same test is not reliable as you witnessed with the failure. So we should likely find a better way to do this test. Maybe by allowing failures on "objdump -a" or by using something else. I just made a test and noticed that while objdump fails on binaries of other architectures, readelf does work... but its output is human readable and not really suitable for machine parsing. > We could also stop working around problems and start fixing the mess > instead. That's what I'm doing too... > I say let's go back to what worked and fix this properly. Why are you > backing off now? You did agree on reverting it on regressions earlier. > Now there is a regression. How much more crystal clear could it be? Why do you need to be so agressive? I'm fine with a revert if we can't find a better fix as I don't want to affect your work negatively. But it's also crystal clear to me that a revert is not a "proper fix". The thing worked before because it stopped at the first library found and it was always one for the correct architecture. Unfortunately it was not always found in the correct path. Ne we will always find it in the correct path but we also find libraries for non-matching architectures and "objdump -a" unhelpfully barfs at those. /bin/file also knows how to identify the ELF file format of any architecture but again it's not something really suitable for machine consumption. I am thus suggesting the attached patch to ignore objdump failures when we try to identify the file format but to warn about it so that we can still have hints about the ignored library if anything goes wrong later on. Can you retry your cross-compiler build with this patch? I would like to note that while the "objdump -a" failure does not happen in all cases, I can inspect armhf binaries in my amd64 machine but not the opposite. Cheers, -- Raphaël Hertzog ◈ Debian Developer Support Debian LTS: http://www.freexian.com/services/debian-lts.html Learn to master Debian: http://debian-handbook.info/get/
>From 86f59e1cc7b94ff8010117d42f87772b39a4b881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hert...@debian.org> Date: Thu, 5 Jan 2017 12:16:11 +0100 Subject: [PATCH] Dpkg::Shlibs: ignore "objdump -a" failures in find_library() On some architectures, "objdump -a" fails when trying to process a foreign library with a message like this one: objdump: /usr/lib/x86_64-linux-gnu/libc.so: File format not recognized Since a927295c93fb7a17742441aa863aaffcf4a351b5 we are now analyzing all libraries found and not only the first one found, so we can't afford to fail just because objdump -a failed, instead we just issue a warning. If the failure is not due to this problem, dpkg-shlibdeps will barf a bit later because it was not able to find the library so I did not add an error in case we issued a warning but did not find any other instance of the same library. Closes: #849913 --- scripts/Dpkg/Shlibs.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm index 3bb3c7baf..24ffc81c9 100644 --- a/scripts/Dpkg/Shlibs.pm +++ b/scripts/Dpkg/Shlibs.pm @@ -156,9 +156,14 @@ sub find_library { foreach my $dir (@librarypaths) { my $checkdir = "$root$dir"; if (-e "$checkdir/$lib") { - my $libformat = Dpkg::Shlibs::Objdump::get_format("$checkdir/$lib"); - if ($format eq $libformat) { - push @libs, canonpath("$checkdir/$lib"); + eval { + my $libformat = Dpkg::Shlibs::Objdump::get_format("$checkdir/$lib"); + if ($format eq $libformat) { + push @libs, canonpath("$checkdir/$lib"); + } + }; + if ($@) { + warning("could not identify ELF format of %s", "$checkdir/$lib"); } } } -- 2.11.0