Cross compile error question: i686 to powerpc--linux-gnu

Joe Sislow
Wed Oct 17 11:38:00 GMT 2001

David Korn wrote:

> >-----Original Message-----
> >From: Joe Sislow [ ]
> >Sent: 17 October 2001 18:11
> >Ok, that's helpful, but confusing (as NONE of the CrossGCC faq's cover
> >using glibc).
> Except of course for this bit from the front page:
> ------snip!------
> Building glibc
> TODO: The author is still documenting this procedure, which you need if
>  you're building a <target>-linux crossdevelopment toolset.
> ------snip!------

Well, that's what I meant...not that it didn't refer to it, but that nothing on
how to do it is done yet. ;)

> >Maybe I can just cut to the chase here and see if you can help...
>   It's fairly likely, I had to help one of my workmates here sort out a
> ppc-linux-gnu toolchain just a couple of weeks back.  We had a couple of
> problems with getting glibc to build but it was nothing major, just getting
> our choices of options and stuff straight sorted it out.

Thanks in advance for helping with this, btw...

> >Why does GCC need all of these libraries recompiled to output standard C
> >code?  I can understand that the linker and assembler might need to know
> >more about the hardware, but why is it so hard to get GCC to just spit out
> >the right code to binutils?
>   Well, it doesn't, and indeed the partially working compiler in the gcc
> subdir can do just that, compiling C to assembly which then assembles to
> relocatable obj files.  It's only when the linker then tries to stick those
> together and none of the undefined references are fulfilled that you get
> trouble.

Wait...what undefined references?  I wrote the small sample program below with
NO external headers, and the linker choked...

int main (int x, int y)
    int sum;
    int z = 9;

    sum = x + y;

    return sum;

What can't it find?  I would assume that it's looking for some link info on how
to lay out the memory, but it LOOKS to me like the PPC assembly code is being
generated correctly.  Is this where I could run the linker manually (not with
gcc -o, which is what I tried) and get through?  Or is it more likely because
the newlib stuff is wrong for my target?

>   As far as 'all those' libraries, there's not that many of them.  libio
> provides I/O support for stdio.h and C++ STL streams, libstdc++ is STL,
> libiberty is a pretty small lib with some widely useful posix routines that
> aren't available on all platforms, and libgcc is the compiler's vital
> internal support library.

BTW, we're not using any C++ functionality...can I deal that out by using
-LANGUAGE=c during the make?

> >Anyway...long story short...if we want to provide our own
> >library support, do
> >I NEED to go any further than making the bootstrap compiler?
>   Nope.  The only real *essential* is libgcc.  This contains a very few
> vital support routines for the compiler's output: things like extended maths
> functions for long long support on cpus that don't handle them natively,
> routines to handle calling exceptions and unwinding stack frames, etc.,
> and you'll already have that if the compiler itself built ok.
> >I'm not going to
> >use Linux, I'm not going to use GNU (most likely), am I
> >going too far in
> >something I don't need to do?
>   Well, you already went way too far, the very first moment you typed
> --target=powerpc--LINUX-GNU.  Don't try telling lies to the configure/build
> process and hoping it will still work; it *knows* an awful lot about the
> various architectures it runs on and there's no reason to mislead it.
>   It sounds like you'd be much better off with powerpc-eabi, which you *can*
> use with newlib.

Well, part of the problem was that I was having trouble finding much
documentation on what all of the possibilities for building various PowerPC
targets were.  I was trying Linux because I figured it'd be straightforward.  I
was worried, though, that I was getting into more unknown waters with anything
OTHER than Linux-gnu, because I didn't know what the other OS's and libraries

And, on Bill Gatliff's page, he refers to problems building the libiberty when
building powerpc-eabi...will I still hit final compile issues there?

Joe Sislow
Cosmodog, Ltd.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list