Bug#373193: About #373193
> > - add option to dpkg-buildpackage not to use gccross
> I'd like to understand how that works first. dpkg-cross's
> dpkg-buildpackage wrapper uses gccross if -a arch != $build has been
> requested? dpkg-bp calls configure with (possibly implicit) --host
> $build --build $build? dpkg-bp calls rules with CC=gccross? And gccross
> pretends to be $build's native compiler, but calls the cross-compiler
> and rewrites the -I / -L paths accordingly? Please correct me if
> anything is wrong.
dpkg-buildpackage from dpkg-cross just sets DEB_HOST_* variables in
cross-compilation case, the rest is done by normal dpkg-buildpackage.
Gccross is substituted similar to tools like distcc or ccache - by
prepending to PATH a directory that has symlinks to gccross named "gcc",
"g++", "$target-gcc", "$target-g++" and similar. Those are prepared by
dpkg-cross version of dpkg-buildpackage.
When started, gccross checks command line, replaces paths from -I and -L
args if those don't point to cross-compilation dirs, and calls next
argv in path.
> My understanding is that gccross is a good short-term solution, and in
> the long-term all packages should be cross-build aware and use the right
> tools themselves. In fact, my package is configured with
> --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE), so make
> should already call the right compiler with the right paths.
It's not that easy. Also issues that come from xxx-config and other scripts
that print compiler arguments should be addressed. It is solvable e.g. by
creating alternate versions of such scripts at 'dpkg-cross -b' stage and
forcing those to PATH at cross-compile time, but that needs to be
implemented and checked.
> So, with my current understanding, I think even further, there should be
> a mechanism (an option, environment variable, whatever) to *enable*
> using gccross. It should be disabled by default since compliant packages
> don't need it.
> What do you think?
See above. I still agree with Raphael (gccross author) that this should be
enabled by default - at least until (almost) all debian packages will
cross-compile without it.