Fedora and Cross Compiling
Hans de Goede
j.w.r.degoede at hhs.nl
Sat Jun 9 09:23:06 UTC 2007
David Woodhouse wrote:
> On Fri, 2007-06-08 at 13:56 -0600, Brendan Conoboy wrote:
>> Building a cross binutils requires kernel headers for the target
>> architecture. Building gcc requires kernel headers and glibc. There
>> are scripts to solve the initial chicken/egg problem of where to get
>> that glibc for a new arch. At some point in the future gcc might not
>> require glibc to build, but we aren't there yet.
> Before we get to actually cross-compiling something for release, it
> would be good to get cross-compilers into Fedora.
> Making a cross-binutils package isn't hard; it's a relatively
> modification to our existing binutils package to make it build for
> multiple %targets.
> Making a cross-gcc package which targets linux-elf is harder, because of
> the evil recursive dependencies to which you refer above. It would be
> good if we could get that working though.
> Unfortunately the scripts to which you refer just 'solve' the problem by
> throwing everything together into one huge lump and building gcc, then
> glibc, then rebuilding gcc again. That's not really very useful for us
> when we want the compiler and glibc to be entirely separate packages --
> and in fact glibc would be a .$TARGET.rpm to be installed into the
> sysroot, while the compiler is a native package.
> I haven't looked at this for a while, but IIRC we can build gcc and
> libgcc.a directly, using 'only' header files which can be provided in
> advance. The problem is that we have to dynamically link libgcc.so with
> libc.so? We don't actually need a _real_ libc.so for that though, do we?
> We could just make a dummy DSO with the functions we want, and link
> against that? If we do that, what else still has recursive dependencies?
Notice that I have spends weeks on fixing exactly the problems, with creating a
cross compiling gcc targeting linux with glibc, described here to build an
cross arm toolchain for the gp2x handheld for Fedora.
For all my SRPMS / SPECS for this, with regards to solving the above metioned
problems esp arm-gp2x-linux-gcc.spec is interesting. I think I've got this one
nailed, so before other people start pouring time into this please first check
my work, doing this for other linux-glibc targets, using Fedora sources instead
of the open2x sources I'm using should be mostly identical. I'll gladly answer
Reviews would be welcome to, see:
For links to all the review tickets.
More information about the fedora-devel-list