This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot build a gcc cross-compiler


I attached to this message the script I'm using for building my toolchain. It is much more primitive than crosstool-ng (I still haven't managed to run it properly) but also much easier to understand.

Another difference is that I'm trying to use the very latest releases instead of using older ones.

The script runs successfully until the glibc is compiled: this one fails with the following error message:

/mnt/lfs/stage1/usr/lib/gcc/i686-unknown-linux-gnu/4.4.1/../../../../i686-unknown-linux-gnu/bin/ld: cannot find -lgcc_eh
collect2: ld returned 1 exit status
make[2]: *** [/mnt/lfs/sources/glibc-build/iconv/iconvconfig] Error 1
make[2]: Leaving directory '/mnt/lfs/sources/glibc-2.10.1/iconv'
make[1]: *** [iconv/others] Error 2
make[1]: Leaving directory '/mnt/lfs/sources/glibc-2.10.1'
make: *** [all] Error 2


What can I do?
#!/bin/bash

export LFS=/mnt/lfs
export LFS_HOST=x86_64-unknown-linux-gnu
export LFS_TARGET=i686-unknown-linux-gnu
export CFLAGS="-O2 -march=core2"

export TAR_BINUTILS=binutils-2.19.1.tar.bz2 SRC_BINUTILS=binutils-2.19.1
export TAR_GCC=gcc-4.4.1.tar.bz2 SRC_GCC=gcc-4.4.1
export TAR_GLIBC=glibc-2.10.1.tar.bz2 SRC_GLIBC=glibc-2.10.1
export TAR_GMP=gmp-4.3.1.tar.bz2 SRC_GMP=gmp-4.3.1
export TAR_LINUX=linux-2.6.30.1.tar.bz2 SRC_LINUX=linux-2.6.30.1
export TAR_MPFR=mpfr-2.4.1.tar.bz2 SRC_MPFR=mpfr-2.4.1

create_directories() {

	mkdir ${LFS}/stage1/lib64 || exit 1
	mkdir ${LFS}/stage1/usr || exit 1
	mkdir ${LFS}/stage1/usr/lib64 || exit 1
	mkdir ${LFS}/stage1/usr/local || exit 1
	mkdir ${LFS}/stage1/usr/local/lib64 || exit 1

}

create_symlinks() {

	cd ${LFS}/stage1 || exit 1
	ln --symbolic lib64 lib || exit 1
	cd ${LFS}/stage1/usr || exit 1
	ln --symbolic lib64 lib || exit 1
	cd ${LFS}/stage1/usr/local || exit 1
	ln --symbolic lib64 lib || exit 1

}

install_binutils() {

	cd ${LFS}/sources || exit 1
	tar --extract --file=${TAR_BINUTILS} || exit 1
	mkdir binutils-build || exit 1
	cd binutils-build || exit 1
	../${SRC_BINUTILS}/configure \
	--prefix=${LFS}/stage1/usr \
	--build=${LFS_HOST} \
	--host=${LFS_HOST} \
	--target=${LFS_TARGET} \
	--with-sysroot=${LFS} || exit 1
	make || exit 1
	make install || exit 1
	cd ${LFS}/sources || exit 1
	rm --recursive --force ${SRC_BINUTILS} || exit 1
	rm --recursive --force binutils-build || exit 1

}

install_gcc1() {

	cd ${LFS}/sources || exit 1
	tar --extract --file=${TAR_GCC} || exit 1
	tar --extract --file=${TAR_GMP} || exit 1
	mv ${SRC_GMP} ${SRC_GCC}/gmp || exit 1
	tar --extract --file=${TAR_MPFR} || exit 1
	mv ${SRC_MPFR} ${SRC_GCC}/mpfr || exit 1
	mkdir gcc-build || exit 1
	cd gcc-build || exit 1
	../${SRC_GCC}/configure \
	--prefix=${LFS}/stage1/usr \
	--build=${LFS_HOST} \
	--host=${LFS_HOST}  \
	--target=${LFS_TARGET} \
	--enable-languages=c \
	--with-sysroot=${LFS} \
	--disable-libgomp \
	--disable-libmudflap \
	--disable-libssp \
	--disable-shared \
	--disable-decimal-float \
	--disable-threads \
	--without-headers \
	--with-newlib || exit 1
	make || exit 1
	make install || exit 1
	cd ${LFS}/sources || exit 1
	rm --recursive --force ${SRC_GCC} || exit 1
	rm --recursive --force  gcc-build || exit 1

}

install_gcc2() {

	cd ${LFS}/sources || exit 1
	tar --extract --file=${TAR_GCC} || exit
	tar --extract --file=${TAR_GMP} || exit
	mv ${SRC_GMP} ${SRC_GCC}/gmp || exit 1
	tar --extract --file=${TAR_MPFR} || exit
	mv ${SRC_MPFR} ${SRC_GCC}/mpfr || exit 1
	mkdir gcc-build || exit 1
	cd gcc-build || exit 1
	../${SRC_GCC}/configure \
	--prefix=${LFS}/stage1/usr \
	--build=${LFS_HOST} \
	--host=${LFS_HOST} \
	--target=${LFS_TARGET} \
	--enable-languages=c \
	--with-sysroot=${LFS} || exit 1
	make || exit 1
	make install || exit 1
	cd ${LFS}/sources || exit 1
	rm --recursive --force ${SRC_GCC} || exit 1
	rm --recursive --force gcc-build || exit 1

}

install_glibc() {

	cd ${LFS}/sources || exit 1
	tar --extract --file=${TAR_GLIBC} || exit 1
	mkdir glibc-build || exit 1
	cd glibc-build || exit 1
	../${SRC_GLIBC}/configure \
	CC=${LFS}/stage1/usr/bin/${LFS_TARGET}-gcc \
	--prefix=${LFS}/usr \
	--build=${LFS_HOST} \
	--host=${LFS_TARGET} \
	--with-headers=${LFS}/usr/include \
	--enable-kernel=2.6.30.1 \
	libc_cv_forced_unwind=yes \
	libc_cv_c_cleanup=yes || exit 1
	make || exit 1
	make install || exit 1
	cd ${LFS}/sources || exit 1
	rm --recursive --force ${SRC_GLIBC} || exit 1
	rm --recursive --force glibc-build || exit 1

}

install_linux() {

	cd ${LFS}/sources || exit 1
	tar --extract --file=${TAR_LINUX} || exit 1
	cd ${SRC_LINUX} || exit 1
	make INSTALL_HDR_PATH=dest headers_install || exit 1
	mkdir ${LFS}/usr || exit 1
	cp --recursive dest/include ${LFS}/usr || exit 1
	cd ${LFS}/sources || exit 1
	rm --recursive --force ${SRC_LINUX} || exit 1

}

create_directories
create_symlinks

install_binutils
install_gcc1
install_linux
install_glibc
install_gcc2

exit 0

--
For unsubscribe information see http://sourceware.org/lists.html#faq

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]