[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cross compilers for non-x86 hosts

On 2018-04-27 11:22 +0100, Alex Bennée wrote:
> Hi,
> I was pleasantly surprised to find the docker-ce in stretch was already
> multi-arch aware so all the base Debian images where pulled down in
> their aarch64 forms. However the images failed to build because the
> compilers where not available in the aarch64 archive. For example:
>   https://packages.debian.org/sid/gcc-alpha-linux-gnu
> Only has binaries for amd64, i386 and an unofficial x32 build.
> So aside from the usual time and inclination is there anything in
> particular stopping the cross compilers being built for the other
> supported architectures?

Obviously the full set of possible cross-compilers is large, and some
will be very rarely used, so we choose a sensible subset to build in
the archive. That is generally from fast/popular arches to
slow/unpopular ones. It does probably now make sense to add more 'from
arm64' cross compilers to the standard build list.

But we will probably never have all combos in the archive.

The fill-in for people needing cross-compilers which are not packaged
is to use the cross-gcc-dev package, which will build you an arbitrary
(set of) wrapper-package(s) which you can use to build cross-compilers
using (essentially) the same mechanisms used in the standard

This should be documented here:
https://wiki.debian.org/CrossToolchains but that mostly hasn't been
updated for 3 years so quite a lot is out of date, and I've failed to
find a bit telling you how/when to use cross-gcc-dev.

But I just tried it for alpha and it was a bit fafftastic and then
didn't actually work due to some patch not applying.

So a better plan is what you were trying to do:

> I did download the gcc-defaults source package but I'm unsure what the
> correct invocation is to build an individual set of packages for one
> target. What would the correct dpkg-buildpkg invocation be to build the
> alpha toolchain for example?

gcc-defaults is the wrong package. gcc-7 or gcc-8 have the right machinery.

DEB_BUILD_OPTIONS="nolang=d,go,java,objc,obj-c++,ada" unstripped_exe=no dpkg-buildpackage --target-arch alpha -d -T control; \
DEB_BUILD_OPTIONS="nolang=d,go,java,objc,obj-c++,ada" unstripped_exe=no dpkg-buildpackage --target-arch alpha -B -d -uc -us;

for the case noted you should be able to do:
apt source gcc-7
cd gcc-7-7.3.0
DEB_BUILD_OPTIONS="nolang=d,go,java,objc,obj-c++,ada" unstripped_exe=no dpkg-buildpackage --target-arch alpha -d -T control
DEB_BUILD_OPTIONS="nolang=d,go,java,objc,obj-c++,ada" unstripped_exe=no dpkg-buildpackage --target-arch alpha -B -d -uc -us

You may need to build a version-matching linux-libc-dev:alpha first
(because the one in the alpha ports repo is out of date (and thus
multiarch sync) with the version in supported arches:

apt source linux
sudo apt-get -Pstage1 --only-source build-dep linux
cd linux-*; dkpg-buildpackage -Pstage1 -aalpha
sudo dpkg -i ../linux-libc-dev_4.15.17-1_alpha.deb

This didn't complete for me but got a fair way (but I wasn't testing on arm64)

Have a go.

Principal hats:  Linaro, Debian, Wookware, ARM

Attachment: signature.asc
Description: PGP signature

Reply to: