Fedora and Cross Compiling

Oliver Falk oliver at linux-kernel.at
Mon Jun 11 08:52:17 UTC 2007


On 06/11/2007 10:28 AM, Andy Green wrote:
> 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.

Sure, Andy I got it. :-) I just wanted to address it. I understand that
there is an easy solution to use another sysroot, but we need to get the
packages/headers/libs there :-)

>>> 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.

Sure, testing is needed anyway, but if testing at %build level doesn't
work, we normally stop and don't build packages... If there would be
some automation for this, that would be great.

>>> 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, I guess you have enough experience with cross compilers and so I
have to believe you. I'm not so ("cross-)experienced(") and that's why I
don't *trust* it until I haven't *tried* it :-)

-of




More information about the fedora-devel-list mailing list