[Pkg-pascal-devel] Bug#845498: Bug#845498: Bug#845498: /usr/bin/fpc-3.0.0: Provide cross-compilers

Helmut Grohne helmut at subdivi.de
Fri Jan 22 09:06:27 GMT 2021


Hi,

On Thu, Jan 21, 2021 at 08:30:10PM +0100, Abou Al Montacir wrote:
> We already patch the compiler to call ld.bfd instead of ld, so we can change the
> name as you wish.

Can you implement just this part and poke me once that has hit unstable?
I can send a patch for the next step then.

> You need to compile the source package with special flags to generate a given
> compiler.
> So this will be as if you build several separate compilers.
> 
> I would advise to make the cross compilers as separate source package that
> relies on FPC source. Otherwise it will be too complicated to package any new
> version. But it is feasible.

Both models are used in Debian and I've gained some experience with
both. For instance, binutils uses the "lump everything
together"-approach. And gcc is split into several source packages
(gcc-10, gcc-10-cross, gcc-10-cross-ports). In my experience the cross
packages go out of sync way too often and I strongly prefer the combined
approach. Why do you think that is getting too complicated?

The way I see things is that rather than building fpc once, the Debian
package would build it a number of times. The build time would go up
significantly, which is a disadvantage, but testing time can be reduced
using build profiles. I think I can help contain this approach.

> The answer is ver easy; fpc -P$z where $z is the suffix of the arch
> (cross)compiler. The suffixes are defined by upstream, but the rules file
> manages to detect them for each dpkg arch using a mapping table. We cal also add
> a helper program that returns fpc arch from dpkg arch.

This is a mix of clang and gcc approaches. Like clang, the target is
specified using a command line switch. Like gcc, we need one binary
executable for every combination of build architecture and host
architecture (simplified, it's a bit less). As such, I think we should
provide packages fpc-${DEB_HOST_ARCH} that makes fpc -P$mapped_arch
work. In a first iteration, we'd just do the "diagonal" of the matrix
(i.e. no cross tools, just working with emulated compilers). The rest
can be filled in later on demand. Cross building fpc itself strongly
depends on a filled matrix, so that part comes last.

Sounds like we do have an implementation sketch now. :)

1. Make fpc call into triplet-ld.bfd instead of ld.bfd.
2. Change the binutils dependency to binutils-triplet | binutils.
-> Foreign installation of an emulated fpc should work.
3. Provide suitable fpc-arch packages from fpc.
4. Add fpc-for-host and fpc-for-build metapackages.
5. Add cross compilers.
-> Cross building with fpc should work.
6. Make fpc cross buildable.
-> Cross building fpc should work.

The devil is in the detail of course.

Helmut



More information about the Pkg-pascal-devel mailing list