Hi!

On Wed, 2013-06-12 at 00:19:15 +0200, Francois Gouget wrote:
> Package: dpkg-dev
> Version: 1.16.10
> Severity: normal

> I work on an i386 package which I build on an amd64 host. To do so I
> use CC='gcc -m32' which produces binaries of the right type. Yet
> dpkg-architecture gives me the following warning:
> 
> dpkg-architecture: warning: specified GNU system type i486-linux-gnu does not 
> match gcc system type x86_64-linux-gnu, try setting a correct CC environment 
> variable
> 
> As far as I can tell this comes from the following line in
> get_gcc_host_gnu_type() of /usr/share/perl5/Dpkg/Arch.pm:
> 
>    my $gcc_host_gnu_type = `\${CC:-gcc} -dumpmachine`;
> 
> My understanding is that '-dumpmachine' always prints the compiler's
> default target machine. Indeed:
> 
>    $ gcc -dumpmachine
>    x86_64-linux-gnu
>    $ gcc -m32 -dumpmachine
>    x86_64-linux-gnu
> 
> That's even probably the appropriate result for get_gcc_host_gnu_type().
> However I don't think that's what dpkg-architecture should be comparing
> to the package's target architecture, particularly not when suggesting
> to fix $CC.
> 
> I think checking the value of '$CC -print-multiarch' would be more
> appropriate:
> 
>    $ gcc -print-multiarch
>    x86_64-linux-gnu
>    $ gcc -m32 -print-multiarch
>    i386-linux-gnu

There's several problems with that. First -print-multiarch is pretty
recent, even if it has been backported way back to gcc 4.6, but before
that it's not supported. The result from -print-multiarch is not the
host triplet, so it cannot be used on the configure command line for
the --host option, because autotools will prefix that to the build
tools when it detects it's in cross-compilation mode, and those
cross-tools will not be found. You might need to override other
variables so that everything gets built for the host (and not build)
triplet, but that should be handled by the packaging, not the builder.

In any case I think the multilib approach is bogus, and its support
should just end. A better solution, is to use an actual cross-toolchain,
or something I was planning on posting to debian-devel is to use some
kind of fake cross toolchain in the interim, internally using the
multilib support, and later on they could be switched to use the main
compiler with a different spec file, or simply replaced with an actual
proper cross-compiler.

Take a look at:

  <http://www.hadrons.org/~guillem/debian/ports/fakecross-i486-0.0.tar.xz>

You'll also need to install at least:

  binutils-multiarch
  libgcc-4.8-dev:i386
  libc6-dev:i386

Move away the bogus instances of some multilib files from native
packages (I've to file a bug about this):

  $ cd /usr/lib/gcc/x86_64-linux-gnu/4.8/
  $ mv 32 32-old

And symlink it to the proper directory:

  $ ln -s ../../i486-linux-gnu/4.8 32

At least that was enough last time I used this. Then you should be
able to simply do:

  $ dpkg-buildpackage -ai386

So given the above, I think I'll be closing this bug report, please
let me know if that solves your issue.

Thanks,
Guillem


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to