Package: dpkg
Version: 1.15.5.6ubuntu4.5
Severity: normal
Tags: patch

Calling the dpkg-architecture command with the "-a" flag while cross compiling
generates a warning that the "Specified GNU system type does not match gcc
system type". The underlying problem is that dpkg-architecture uses the wrong
gcc (${CC:-gcc}) when the "-a" flag is specified.

-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 
'lucid-backports'), (500, 'lucid')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-33-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  coreutils              7.4-2ubuntu3      The GNU core utilities
ii  libc6                  2.11.1-0ubuntu7.8 Embedded GNU C Library: Shared lib
ii  lzma                   4.43-14ubuntu2    Compression method of 7z format in

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                    0.7.25.3ubuntu9.7 Advanced front-end for dpkg

-- no debconf information
>From b9a123990386b490f0abb75f29437e76c5822be0 Mon Sep 17 00:00:00 2001
From: Tom Hughes <[email protected]>
Date: Fri, 7 Oct 2011 14:41:06 -0700
Subject: [PATCH] Fix gcc mismatch when cross compiling.

---
 scripts/Dpkg/Arch.pm         |   12 +++++++++---
 scripts/dpkg-architecture.pl |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 858e0fb..bc6f8ff 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -66,11 +66,17 @@ my %debarch_to_debtriplet;
        return $ENV{DEB_BUILD_ARCH} || get_raw_build_arch();
     }
 
-    sub get_gcc_host_gnu_type()
+    sub get_gcc_host_gnu_type($)
     {
        return $gcc_host_gnu_type if defined $gcc_host_gnu_type;
 
-       my $gcc_host_gnu_type = `\${CC:-gcc} -dumpmachine`;
+       my ($gcc) = @_;
+       my $gcc_host_gnu_type;
+       if (!defined($gcc)) {
+           $gcc_host_gnu_type = `\${CC:-gcc} -dumpmachine`;
+       } else {
+           $gcc_host_gnu_type = `$gcc-gcc -dumpmachine`;
+       }
        if ($? >> 8) {
            $gcc_host_gnu_type = '';
        } else {
@@ -84,7 +90,7 @@ my %debarch_to_debtriplet;
     {
        return $host_arch if defined $host_arch;
 
-       $gcc_host_gnu_type = get_gcc_host_gnu_type();
+       $gcc_host_gnu_type = get_gcc_host_gnu_type(undef);
 
        if ($gcc_host_gnu_type eq '') {
            warning(_g("Couldn't determine gcc system type, falling back to " .
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index 97c0b9f..73c6559 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -248,7 +248,7 @@ if (action_needs(DEB_HOST | DEB_GNU_INFO)) {
     }
     ($v{DEB_HOST_GNU_CPU}, $v{DEB_HOST_GNU_SYSTEM}) = split(/-/, 
$v{DEB_HOST_GNU_TYPE}, 2);
 
-    my $gcc = get_gcc_host_gnu_type();
+    my $gcc = get_gcc_host_gnu_type($v{DEB_HOST_GNU_TYPE});
 
     warning(_g("specified GNU system type %s does not match gcc system " .
                "type %s, try setting a correct CC environment variable"),
-- 
1.7.7

Reply via email to