building cross picks up wrong libc

Rob Taylor robt@flyingpig.com
Wed Oct 3 22:12:00 GMT 2001


I've now spotted the problem here : the libc.so copied over from the target box
was actually a script redirecting to /lib/libc.so.6, so after appropriate copies
and links, this is sorted.
I then hit the problem that powerpc--linux-gnu-ld tells me that crti.o cannot be
found, this turned out to be not passing in --with-libs to gcc,

so, for helping out any other unfortunate souls as myself in future, he's a nice
distilled HOWTO on building a 3.0 ppc crosscompiler to an already existing
target system. it should be easily adaptable to other targets.

--------------

extract binutils-2.11.92.0.10 into /tmp/work/binutils

$ cd /tmp/work
$ mkdir build-binutils
$ cd build-binutils
$ ../binutils/configure --target=powerpc--linux-gnu --prefix=/opt/powerpc
$ make
$ make install

$ export PATH=/opt/powerpc/bin/:$PATH

copy in /usr/lib/*.o from target into /opt/powerpc/powerpc--linux-gnu/lib
copy in /usr/lib/libm.* from target into /opt/powerpc/powerpc--linux-gnu/lib
copy in lastest /lib/* from target into /opt/powerpc/powerpc--linux-gnu/lib
attempt to preserve symbolic links!
link libc.so.6 to  libc.so
copy in /lib/ld.so.1 from target into /opt/powerpc/powerpc--linux-gnu/lib
copy in /usr/include from target into /opt/powerpc/powerpc--linux-gnu/lib



extract gcc-3.0.2 source into /tmp/work/gcc

$ cd /tmp/work
$ mkdir build-gcc
$ cd build-gcc
$ ../gcc/configure --target=powerpc--linux-gnu --prefix=/opt/powerpc \
	--enable-languages=c,c++ --enable-threads=posix --with-libs="/opt/powerpc/power
pc--linkux-gnu/lib"
$ make
$ make install

------------------

> I'm building a i686-pc-linux-gnu to powerpc--linux-gnu cross compiler with
> gcc-3.0.2
> using --prefix=/opt/powerpc for both binutils and gcc
> binutil had built sucessfully
> I've copied the libs and includes over from my target platform into
> /opt/powerpc/powerpc--linux-gnu/
>
> i've configured gcc with
> --target=powerpc--linux-gnu --prefix=/opt/powerpc \
> --enable-languages=c,c++ --enable-threads=posix
>
> when the make of the cross compiler gets up to using xgcc to link libgcc_s.so,
> it picks up my systems /lib/libc.so.6 and understandably fails.
>
> Has anyone any idea why it would be picking up this libc rather than
> /opt/powerpc/powerpc--linux-gnu/lib/libc.so.6 ?
>
> alternatively, does anyone know what the decision logic is for where
> xgcc looks
> for libraries, and where this happens in the source, then I at least have a
> fighting chance of fixing this myself :)
>
> Thanks,
> Rob Taylor
>
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
>


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list