powerpc-linux cross gcc-2.95 with newlib-1.8.1 missing crt1.o

Brendan Simon brendan@dgs.monash.edu.au
Thu Aug 12 00:26:00 GMT 1999

Graham Stoney wrote:

> I'm attempting to build a powerpc-linux cross-compiler from gcc-2.95 to run on
> a Red Hat 6.0 i686-pc-linux-gnu system, with the binutils-990809 snapshot and
> newlib-1.8.1 as my C library. They're all configured with:
>     --target=powerpc-linux --with-gnu-as --with-gnu-ld --with-newlib

Are you sure that Linux cross-compilers can be built using newlib as the C library.  I don't know of any Linux system that uses
newlib.  All Linux systems I know of use glibc and I suspect that is your problem.
You need to get the runtime libs and headers and preinstall them before building binutils and gcc.  You can get some rpms (see
below) and unpack them into $prefix/$target/include and $prefix/$target/lib.  You also need the linux source header files.

I found one of Kai Ruottu's emails in my files at work.
He gave me the following URLs to look at:

- glibc-2.1-1a.ppc.rpm
- glibc-devel-2.1-1a.ppc.rpm

Use rpm and cpio to extract the files into a temporary directory.
$ rpm2cpio glibc-2.1-1a.ppc.rpm > glibc-2.1-1a.ppc.cpio
$ rpm2cpio glibc-devel-2.1-1a.ppc.rpm > glibc-devel-2.1-1a.ppc.cpio
$ cpio -iBdmv < glibc-2.1-1a.ppc.rpm
$ cpio -iBdmv < glibc-devel-2.1-1a.ppc.rpm

After copying all the "lib/..." stuff into "usr/lib" and fixing the
symbolic links in "usr/lib" (those pointing to ../../lib) to point to
the files in the same directory, move the stuff from "usr/lib" and
"usr/include" to $prefix/$target/lib and $prefix/$target/lib

Probably need to fix the "-dynamic-linker" statement in the specs file
($prefix/lib/gcc-lib/$target/$egcs-version/specs) to be "-dynamic-linker

Also need to edit $prefix/$target/lib/libc.so.  Change /usr/lib to

I have copied these instructions from a printed email I found (with some
of my notes scribbled on them).

> The build of gcc-2.95 fails while building libio/iogetline.c with:
> ../../../../gcc-2.95/libio/libio.h:30: _G_config.h: No such file or directory
> This is problem #1; Any ideas where gcc is supposed to find _G_config.h?
> I notice at this point that all the compiler passes are built, so I installed
> gcc-2.95 (despite the above build error), and went ahead and built newlib-1.8.1
> in a spirit of persistance and international understanding.
> newlib built and installed fine, but when I go to compile "hello world" with
> the resulting compiler, crt1.o is missing:
> bash$ powerpc-linux-gcc hello.c
> /home/elph/greyham/linux/ppc/tooldir/host/i686-pc-linux-gnu/powerpc-linux/bin/ld: cannot open crt1.o: No such file or directory
> collect2: ld returned 1 exit status
> This is problem #2; Where is crt1.o supposed to come from?
> newlib-1.8.1 builds crt0.o, and includes numerous crt1.c's, but no crt1.o
> gets built. Is this a configure problem with newlib, or am I going crazy?
> And finally, an off-the-wall question #3 for the newlib crew:
> Is there any plan to add POSIX threads support to newlib?
> Thanking you all very muchly,
> Graham

More information about the Newlib mailing list