[uClibc]uClicb and cross-compile for PowerPC

Erik Andersen andersen at lineo.com
Thu May 31 17:37:41 UTC 2001


On Tue May 29, 2001 at 01:47:42PM -0400, Guy Bilodeau wrote:
> Hi all,
>   We are using Mandrake 7.2 to cross-compile on PC's for PowerPC
> targets.
>   The ultimate goal would be to replace libc.so and whatever other libs
>   depend on it with uClibc versions to reduce the code footprint
>   and the RAM usage.
>   Not an easy task as the entire protocol stack and all our applications
>   depend on these and some primitives may be missing or buggy.
>   It appears that the usage of cross-compiler for uClibc is not that
> well tested
>   or maybe it's me.

I just cross compiled uClibc for arm/uClinux without any trouble.
I edited Config so that 
    TARGET_ARCH=arm
    NATIVE_CC = gcc
    CROSS = arm-linux-
    KERNEL_SOURCE=/home/andersen/CVS/uClinux-2.0.x
    etc...
and everything compiled up just fine...  Hmm...  Lets see what
is different.

>   Nevertheless, here is a log of the steps I had to follow just 
>   to cross-compile uClibc.
>    
[----------snip----------------]
> - make failed
> 
> make[3]: Entering directory `/home/guy/dev_uc4/uClibc/libc/misc/assert'
> /home/guy/dev/bin/powerpc-linux-gcc  -Wall -O2 -fno-builtin -nostdinc
>   -I../../../include
> -I/usr/local/lib/gcc-lib/powerpc-linux/2.95.2/include
>    -I. -D_LIBC   -DNDEBUG  -c __assert.c -o __assert.o
> powerpc-linux-gcc: installation problem, cannot exec `cpp':
>  No such file or directory

This looks like your cross compiler is not built properly.  If
powerpc-linux-gcc is calling "cpp" instead of "powerpc-linux-cpp", that is a
clear sign that something isn't built properly with your cross compiler.

> - Many problems here in extra/scripts/get-needed-libgcc-objects.sh:
> 
> a) nm is used instead of powerpc-linux-nm (may explain elf32ppc / i386
> confusion)
> b) libgcc.a not found
> c) other problems ?
> 
> Solutions, 1st attempt:
> a) help to find correct location of libgcc.a by passing its CFLAGS to
> $CC
>      LIBGCC=`$CC $CFLAGS -print-libgcc-file-name`
> b) replace nm -> $NM, ar -> $AR, pass these args and CFLAGS in the
> proper 
>   parent Makefile,
>   libc/Makefile :
>     @(cd tmp; CC=$(CC) LD=$(LD) NM=$(NM) AR=$(AR) CFLAGS="$(CFLAGS)" \
>     /bin/sh ../../extra/scripts/get-needed-libgcc-objects.sh)
> c) add NM definition to Config.powerpc:
>     NM = $(CROSS)nm

Good catch.  I've fixed these up.

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the uClibc mailing list