On Wed, Oct 28, 2009, Hector Oron wrote:
> LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/powerpc-linux-gnu/lib
>  ARCH=powerpc MAKEFLAGS="CC=something" dh_shlibdeps -plibgcc1-powerpc-cross
> 
> error while loading shared libraries: /usr/powerpc-linux-gnu/lib/libc.so.6: 
> ELF file data encoding not little-endian

 Could you DH_VERBOSE + strace that?  Either some powerpc binary gets
 run which shouldn't be (perhaps you have a qemu binfmt wrapper
 installed?) or some tool is not able to read that data.

 I wonder whether it still happens with the attached dpkg-deb patch?

   Thanks
-- 
Loïc Minier
--- scripts/Dpkg/Shlibs/Objdump.pm	2010-03-16 11:29:49.000000000 +0100
+++ /usr/share/perl5/Dpkg/Shlibs/Objdump.pm	2010-03-24 13:43:05.601524516 +0100
@@ -78,8 +78,13 @@ sub has_object {
		    return $format{$file};
		} else {
		    local $ENV{LC_ALL} = "C";
-		    open(P, "-|", "objdump", "-a", "--", $file)
-			|| syserr(_g("cannot fork for %s"), "objdump");
+		    my $od = "objdump";
+		    # cross-compiling?
+		    if ($ENV{'DEB_BUILD_GNU_TYPE'} ne $ENV{'DEB_HOST_GNU_TYPE'}) {
+			$od = $ENV{'DEB_HOST_GNU_TYPE'} . "-objdump";
+		    }
+		    open(P, "-|", "$od", "-a", "--", $file)
+			|| syserr(_g("cannot fork for %s"), "$od");
		    while (<P>) {
			chomp;
			if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) {
@@ -87,7 +92,7 @@ sub has_object {
			    return $format{$file};
			}
		    }
-		    close(P) or subprocerr(_g("objdump on \`%s'"), $file);
+		    close(P) or subprocerr(_g("$od on \`%s'"), $file);
		}
	    }
	}
@@ -152,8 +157,13 @@ sub _read {
	    $self->{file} = $file;
	
	    local $ENV{LC_ALL} = 'C';
-	    open(my $objdump, "-|", "objdump", "-w", "-f", "-p", "-T", "-R", $file)
-		|| syserr(_g("cannot fork for %s"), "objdump");
+	    my $od = "objdump";
+	    # cross-compiling?
+	    if ($ENV{'DEB_BUILD_GNU_TYPE'} ne $ENV{'DEB_HOST_GNU_TYPE'}) {
+		$od = $ENV{'DEB_HOST_GNU_TYPE'} . "-objdump";
+	    }
+	    open(my $objdump, "-|", "$od", "-w", "-f", "-p", "-T", "-R", $file)
+		|| syserr(_g("cannot fork for %s"), "$od");
	    my $ret = $self->_parse($objdump);
	    close($objdump);
	    return $ret;

Reply via email to