Fedora and Cross Compiling

Andy Green andy at warmcat.com
Mon Jun 11 08:28:33 UTC 2007


Oliver Falk wrote:
> On 06/08/2007 09:32 PM, Brendan Conoboy wrote:
>> Oliver Falk wrote:
>>> Good self introduction. Now we know, that you know what you're talking
>>> 'bout. :-)
>> I pretend well, anyway :-)  I'll see if some more folks from my group
>> will jump in here.
>>
>>> 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*...
>> Reliable?  Sure.  But there are problems unique to cross compiling which
>> must be addressed.  You don't want to pull in a host-header instead of a
>> target-header.
> 
> Issue number 1.

>From gcc manpage

--sysroot=dir
           Use dir as the logical root directory for headers and
libraries.  For example, if the compiler would normally search for
           headers in /usr/include and libraries in /usr/lib, it will
instead search dir/usr/include and dir/usr/lib.

>> You also can't run the resulting executables so
>> post-build testsuites can't be run.
> 
> Issue number 2.

Well they can't be run on the build box, that is true.  But they can be
packaged and run on the real target along with the binary itself, which
will still need testing on a real target anyway.

>> That said, object and executable
>> generation is pretty much the same whether your cross compile or
>> natively compile, so you're going to get functionally identical bits.
> 
> OK. That might be true for gcc, but how about gcj? Or other compilers?
> I'm also thinking about python that emits byte-code. Is this code
> machine independent? I'm not sure; Could google or read, but just want
> to mention....

Well look, if I compile "Hello World" on an ARM using an ARM native
compiler, it should do the same result as if I compile it on an x86
using an x86 native compiler or I cross compile it somehow, right?  All
of them print "Hello World" when run on something that can run the
result.  gcc shouldn't be any different, bugs in the compiler
notwithstanding, no matter how you build the same sources they should
work identically when you run them, no matter what platform or CPU.

-Andy




More information about the fedora-devel-list mailing list