[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] toolchain boostrap on mpc8540 e500, stubs-32.h missing



Hello!

I am working on an MPC8540 PowerPC platform and try to bootstrap a
current toolchain with e500 math support support.

I have a native compiler and environment running on the MPC8540 system:

mainline binutils-2.17

mainline glibc-2.3.4 which was built with
        ../glibc-2.3.4/configure
                --prefix=/usr
                --disable-profile
                --enable-kernel=2.6.0
                --without-fp
                --without-cvs
                --enable-add-ons

mainline gcc-4.1.2
Using built-in specs.
Target: powerpc-unknown-linux-gnu
Configured with: ../gcc-4.1.2/configure --prefix=/usr --libexecdir=/usr/lib \
 --enable-languages=c,c++,objc --enable-threads=posix \
 --enable-__cxa_atexit --enable-clocale=gnu --enable-shared \
 --disable-nls --with-x=no --with-float=soft
Thread model: posix
gcc version 4.1.2 (ckcore)


I followed the crossbuild instructions of Jim Blandy to rebuild the entire toolchain:
http://www.eglibc.org/cgi-bin/viewcvs.cgi/*checkout*/branches/eglibc-2_5/libc/EGLIBC.cross-building
It works pretty well until the last gcc3 step, where it barks:

/home/clemens/cross-build/ppc/obj/gcc3/./gcc/xgcc -B/home/clemens/cross-build/ppc/obj/gcc3/./gcc/ -B/home/clemens/cross-build/ppc/tools/powerpc-none-linux-gnu/bin/ -B/home/clemens/cross-build/ppc/tools/powerpc-none-linux-gnu/lib/ -isystem /home/clemens/cross-build/ppc/tools/powerpc-none-linux-gnu/include -isystem /home/clemens/cross-build/ppc/tools/powerpc-none-linux-gnu/sys-include -O2 -O2 -g -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I. -I/home/clemens/cross-build/src/gcc-4.1.2/gcc -I/home/clemens/cross-build/src/gcc-4.1.2/gcc/. -I/home/clemens/cross-build/src/gcc-4.1.2/gcc/../include -I/home/clemens/cross-build/src/gcc-4.1.2/gcc/../libcpp/include   -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time  -msdata=none \
          -c /home/clemens/cross-build/src/gcc-4.1.2/gcc/crtstuff.c -DCRT_BEGIN \
          -o crtbegin.o
In file included from /home/clemens/cross-build/ppc/sysroot/usr/include/features.h:345,
                 from /home/clemens/cross-build/ppc/sysroot/usr/include/stdio.h:28,
                 from /home/clemens/cross-build/src/gcc-4.1.2/gcc/tsystem.h:90,
                 from /home/clemens/cross-build/src/gcc-4.1.2/gcc/crtstuff.c:68:
/home/clemens/cross-build/ppc/sysroot/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory `/share/home/clemens/cross-build/ppc/obj/gcc3/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/share/home/clemens/cross-build/ppc/obj/gcc3'
make: *** [all] Error 2


/home/clemens/cross-build/ppc/sysroot/usr/include/gnu/stubs.h only contains:
-----8<-----
/* This file selects the right generated file of `__stub_FUNCTION' macros
   based on the architecture being compiled for.  */

#include <bits/wordsize.h>

#if __WORDSIZE == 32
# include <gnu/stubs-32.h>
#elif __WORDSIZE == 64
# include <gnu/stubs-64.h>
#else
# error "unexpected value for __WORDSIZE macro"
#endif
-----8<-----

There is no stubs-32.h as well as no stubs-64.h
I tried to recompile it after some googling with --disable-multilib but
without success.

Any ideas what I missed?

Attached, is my build-script (crossme).

Thanks,
--
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
#!/bin/bash

build=powerpc-unknown-linux-gnu
host=$build
target=powerpc-none-linux-gnu
linux_arch=powerpc

binutilsv=binutils-2.17
gccv=gcc-4.1.2
linuxv=linux-2.6.20.5
eglibcv=$HOME/svn/eglibc/trunk/libc

top=$HOME/cross-build/ppc
src=$HOME/cross-build/src
download=$HOME/cross-build/download

function echostatus {
	echo "---------------------------------------------------------------"
	echo $1
	echo "---------------------------------------------------------------"
}

echostatus "download all my sources"

cd $download
wget -nc ftp://ftp.gnu.org/gnu/binutils/$binutilsv.tar.bz2
wget -nc ftp://ftp.gwdg.de/pub/misc/gcc/releases/$gccv/$gccv.tar.bz2
wget -nc http://kernel.org/pub/linux/kernel/v2.6/$linuxv.tar.bz2



echostatus "cleanup and prepare"

rm -rf $top
rm -rf $src
mkdir -p $top
mkdir -p $src



echostatus "build new binutils for the target"

cd $src
tar -xvf $download/$binutilsv.tar.bz2

obj=$top/obj
tools=$top/tools
sysroot=$top/sysroot

mkdir -p $obj/binutils
cd $obj/binutils
$src/$binutilsv/configure \
	--target=$target \
	--prefix=$tools \
	--with-sysroot=$sysroot
make
make install


echostatus "build first gcc"

cd $src
tar -xvf $download/$gccv.tar.bz2

mkdir -p $obj/gcc1
cd $obj/gcc1
$src/$gccv/configure \
	--target=$target \
	--prefix=$tools \
	--without-headers --with-newlib \
	--disable-shared --disable-threads --disable-libssp \
	--disable-libgomp --disable-libmudflap \
	--enable-languages=c \
	--disable-multilib


PATH=$tools/bin:$PATH make
PATH=$tools/bin:$PATH make install


echostatus "linux kernel headers"

cd $src
tar -xvf $download/$linuxv.tar.bz2

cp -r $src/$linuxv $obj/linux
cd $obj/linux

PATH=$tools/bin:$PATH \
	make headers_install \
	ARCH=$linux_arch \
	CROSS_COMPILE=$target- \
	INSTALL_HDR_PATH=$sysroot/usr


echostatus "eglibc headers and preliminary Objects"

# ----- copy eglibc from svn
cp -r $eglibcv $src/libc

mkdir -p $obj/eglibc-headers

cd $obj/eglibc-headers
BUILD_CC=gcc \
	CC=$tools/bin/$target-gcc \
	CXX=$tools/bin/$target-g++ \
	AR=$tools/bin/$target-ar \
	RANLIB=$tools/bin/$target-ranlib \
$src/libc/configure \
	--prefix=/usr \
	--with-headers=$sysroot/usr/include \
	--build=$build \
	--host=$target \
	--disable-profile --without-gd --without-cvs --enable-add-ons

make install-headers install_root=$sysroot \
	install-bootstrap-headers=yes

mkdir -p $sysroot/usr/lib
make csu/subdir_lib
cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib

$tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \
	-o $sysroot/usr/lib/libc.so


echostatus "second gcc"

mkdir -p $obj/gcc2
cd $obj/gcc2
$src/$gccv/configure \
	--target=$target \
	--prefix=$tools \
	--with-sysroot=$sysroot \
	--disable-libssp --disable-libgomp --disable-libmudflap \
	--enable-languages=c \
	--disable-multilib
PATH=$tools/bin:$PATH make
PATH=$tools/bin:$PATH make install



echostatus "eglibc final"

mkdir -p $obj/eglibc
cd $obj/eglibc
BUILD_CC=gcc \
	CC=$tools/bin/$target-gcc \
	CXX=$tools/bin/$target-g++ \
	AR=$tools/bin/$target-ar \
	RANLIB=$tools/bin/$target-ranlib \
$src/libc/configure \
	--prefix=/usr \
	--with-headers=$sysroot/usr/include \
	--build=$build \
	--host=$target \
	--disable-profile --without-gd --without-cvs --enable-add-ons
PATH=$tools/bin:$PATH make
PATH=$tools/bin:$PATH make install install_root=$sysroot


echostatus "third gcc"

mkdir -p $obj/gcc3
cd $obj/gcc3
$src/$gccv/configure \
	--target=$target \
	--prefix=$tools \
	--with-sysroot=$sysroot \
	--disable-libssp --disable-libgomp --disable-libmudflap \
	--enable-languages=c,c++ \
	--disable-multilib
PATH=$tools/bin:$PATH make
PATH=$tools/bin:$PATH make install

echostatus "testing..."

cat > hello.c <<EOF
#include <stdio.h>
int main (int argc, char **argv){
	puts ("Hello, world!");
	return 0;
}
EOF
$tools/bin/$target-gcc -Wall hello.c -o hello

cat > c++-hello.cc <<EOF
#include <iostream>
int main (int argc, char **argv){
	std::cout << "Hello, C++ world!" << std::endl;
	return 0;
}
EOF
$tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello

$tools/bin/$target-readelf -hl hello
$tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1

$sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib ./hello
$sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib ./c++-hello


echostatus "finished..."