Fedora and Cross Compiling

Andy Green andy at warmcat.com
Fri Jun 8 09:21:56 UTC 2007


Oliver Falk wrote:

>> I would like to see cross compilation become a standard method in
>> Fedora.  It scales where native builds don't.  There might be faster arm
>> chips these days, but lets not forget all the underpowered embedded CPUs
>> and costly systems like s390.  Bootstrapping is simplified.  People
>> without access to hardware can work on build problems (Simulators are
>> good for this too).
> 
> True. But is cross compilation really as reliable as native compilation
> is? I'm not experienced with cross compilation... But I think some
> errors will only occur on *real native hardware*...

Cross toolchains are made like this: you use your normal host compiler,
for i386 say, to compile the gcc sources configured to emit target, say
ARM, code.  So you end up with an i386 executable compiler that emits
ARM code.

Native compilers would be built on an ARM box or emulation creating an
ARM executable compiler that emits ARM code.  But in both cases, the
compiler is coming from the same gcc sources.

In either case, if you give it some C to compile, it should emit the
same ARM object file, one happens to emit that ARM object code with a
compiler that is built from i386 instructions itself and another does it
with the same compiler built from ARM instructions itself.  In this way
"real native hardware" has absolutely *nothing* to do with it.

I also went through Brendan's wandering through the desert of
alternative build methods, I started with an NBD-mounted filesystem on a
n x86 box and native compilers in there that ran on my 180MHz ARM9 board
with 32MB of SDRAM (and swap over NBD that worked incidentally).
Compiling a kernel on that worked, but gave me plenty of time, 8 hours
or so IIRC, to ruminate over how addressing the 'fearsome' cross monster
would probably be less painful than going on that way.  And it really
was just another way to get the same compiler sources to emit the same
object faster by running it on a better box... it's just a few minutes now.

> If there are volunteers for a arch and you have some man power who can
> support the ArchTeam, that would be great - I think. If the arch-team
> doesn't want cross compilation..... Let 'em alone. :-)

Cross is a lot less mysterious and magical than it sounds.  Once it is
sorted out according to Fedora's high engineering standards, being able
to build for any supported arch on one physical platform with one
filesystem at native platform speed will in fact be simpler, faster,
more conistent and cheaper than the workarounds.

-Andy




More information about the fedora-devel-list mailing list