Guillem Jover wrote on Sun, Apr 09, 2017 at 03:24:55 +0200:
> On Tue, 2017-02-28 at 15:23:49 +0000, CONSUEGRA Lenny - externe wrote:
> > Package: dpkg-dev
> > Version: 1.17.27
> > Severity: minor
> > Tags: upstream
> 
> > When building a package with dpkg-source, warnings are printed if gcc is
> > not installed on the system :
> > 
> > root@build:/srv/build/tmp/test# dpkg-source -b ublock-origin-1.9.4+dfsg
> >  sh: 1: gcc: not found
> >  dpkg-source: warning: Couldn't determine gcc system type, falling back to 
> > default (native compilation)
> 
> I've analyzed the code, and it does indeed not really require the host
> architecture when building a source package, so I've got a couple of
> commits that get rid of those messages.
> 
> The first disables the perl warnings for when the program is not found
> (the equivalent of first line for 1.18.x, but w/o going via the shell),
> and the second removes the need completely of calling gcc (so the
> second line will not even be emitted).
> 
> I've queued these for 1.19.x.

I see a similar error in another codepath:

% apt-get source hello
% cd hello*/
% dpkg-buildpackage
⋮
dpkg-buildpackage: info: source changed by Salvatore Bonaccorso 
<car...@debian.org>
Can't exec "gcc": No such file or directory at /usr/share/perl5/Dpkg/Arch.pm 
line 165.
dpkg-architecture: warning: cannot determine CC system type, falling back to 
default (native compilation)
⋮

I think the following patch will suffice to address it:

[[[
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index c6321a580..341169c1b 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -158,7 +158,7 @@ sub get_build_arch()
 
     sub get_host_gnu_type()
     {
-        my $CC = $ENV{CC} || 'gcc';
+        my $CC = $ENV{CC} || 'cc';
 
         return $cc_host_gnu_type{$CC} if defined $cc_host_gnu_type{$CC};
 
@@ -175,7 +175,7 @@ sub get_build_arch()
     sub set_host_gnu_type
     {
         my ($host_gnu_type) = @_;
-        my $CC = $ENV{CC} || 'gcc';
+        my $CC = $ENV{CC} || 'cc';
 
         $cc_host_gnu_type{$CC} = $host_gnu_type;
     }
]]]

I tested it in current sid.  I tried to build the package with this
patch, on the assumption that that would run unit tests, but the build
failed both with and without the patch with "error: cannot get project
version" (probably from ./get-version).  I built by running 'pdebuild'
without arguments in a fresh debcheckout.

Cheers,

Daniel

Reply via email to