Cross-compilers.

Brendan Conoboy blc at redhat.com
Mon Sep 18 02:41:10 UTC 2006


David Woodhouse wrote:
> Starting with binutils.... at http://david.woodhou.se/binutils.spec
> there's a specfile based on the current Core package which lets you
> build cross-binutils with for example 
> 	--define "binutils_target i686-fedora-linux"

Any particular reason for the binutils in binutils_target?  Something 
like target_triplet could be shared across multiple packages (gcc, gdb). 
  Also, putting some form of Fedora in the name is great, but it should 
be in some way versioned like i686-fedora5-linux or even i686-fc5-linux. 
  This is a little more specific and will scale better if cross compiler 
interest blossoms.

> That approach lets us track the Core package directly, and I think is
> sanest. What I'm not sure of, however, is how we actually deal with that
> when building for Extras. Is there a simple way we can build it multiple
> times with multiple definitions of %binutils_target, or would we have to
> import it all into multiple directories in CVS with the requisite
> one-line change and then build each one normally?
> 
> Another possibility is that we could make a single SRPM spit out _all_
> the $ARCH-fedora-linux-binutils binary packages, building them all in a
> loop. But that might involve diverging even more from the Core specfile,
> which wouldn't be ideal.

This seems like a pretty small divergence.  Instead of target_triplet 
use target_triplets, use a for loop and you're scarcely any further from 
the original spec file.  That said, three downsides come to mind:

1.  The build will become increasingly slow as targets are added.
2.  A build failure of one target may prevent any target RPMs from being 
produced (optional).
3.  If people want to take the idea and run with it for other targets, a 
single SRPM means less flexible maintainership.

The question that's been gnawing on my mind since your original posting 
is: Where does the sys-root come from?  Clearly for the Fedora targets, 
there exist RPMs that contain the needed files from the existing build 
process.  These need to be available when generating the crosses.  Your 
binutils.spec (nice) assumes there is an installation under 
"/usr/%{binutils_target}".  Whether or not this is the right place, it'd 
be good for there to be a dependency that ensures this exists.

My current thought is that there be a wrapper spec file that takes in 
the target's RPMs, puts them in a standardized directory 
"/usr/share/sys-roots/%{target_triplet}" (imperfect location of the 
day), then makes a noarch RPM out of the contents.  Is this possible in 
the build system?  How do we accommodate the GPL here?  Assuming this is 
a viable option, binutils (gcc, etc) could simply require this package 
prior to building.  Having distinct sys-root packages also accommodates 
other (non-Fedora targeted) systems for which some interest has been shown.

It would be great if Fedora could be cross compiled using any host 
system to produce binaries for any target system, be it a supported and 
rare host (s390, ia64) or an entirely new target (arm, mips*).

-Brendan (blc at redhat.com)




More information about the fedora-devel-list mailing list