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


Please, please... The address for this mailing list is:
  crossgcc@sourceware.org

The one you're using is a legacy alias, drop using it, please...

Sorry I'm not so familiar with mailing lists... I hope I sent this message correctly.


(Oh, BTW, no need for all these "|| exit 1", just use "set -e" at
 the top of your sccript.)

Thanks very much, I didn't know that!


> All in all, that gives 15 steps that are absolutely necessary. So, as
you can see, you're quite missing some of them... I didn't take time
to look at the ./configure options you're using, though...

I managed to build a cross-compiler (from x86_64-cross-linux-gnu to x86_64-unknown-linux-gnu). I again attach the script here. The major thing I had to do was a symlink from libgcc_eh.a to libgcc.a, since libgcc_eh.a is not build when building gcc pass 1.

My procedure is:
linux headers
binutils
gcc pass 1 (minimal)
glibc
gcc pass 2 (full)

Yours seems to be:
linux headers
binutils
gcc pass 1 (minimal)
glibc headers
gcc pass 2 (minimal + threads + tls)
glibc
gcc pass 3 (full)

The main difference is that I build gcc two times and glibc one time, while you build gcc three times and glibc two times. I don't get the reason for building glibc headers... perhaps it is required for a procedure that works whatever the host and the target are (but I repeat, I'm mostly interested in host=target=x86_64 and fake cross-compilation).

ppl, cloog and mpc also seems not to be strictly required by gcc; only gmp and mpfr are.

Now, you said that you did not manage to make crosstool-NG work.
What was the problem you encountered?

First of all I tried configuring it with ./configure --prefix=/mnt/lfs/crosstool-ng but I get:


automake 1.10 or above was not found

I have automake 1.10.2 and 1.11. Anyway I managed to "fix" this by editing the configure script and changing to ver=automake.

Make runs fine.

Then I issue ./ct-ng menuconfig and enter in the kernel-like configuration menu.

The only things I change are the target architecture (to x86) and the target os (to linux). I also chose the latest version of all packages. Another problem: if i try to set target architecture to x86_64 (this is what I really want), I cannot choose glibc as the C library, but the only option is uclibc.

Then I run ./ct-ng build but after a while I get an error while installing (step 'Installing C library') the final glibc (taken from the log file):

[ALL ] make[3]: *** No rule to make target '/mnt/lfs/crosstool-ng/bin/targets/i386-unknown-linux-gnu/build/build-libc/nptl/pthread_spin_trylock.o', needed by 'lib-noranlib'. Stop.

I previously also got tarball extraction problems but I discovered they were due to the lack of inodes.
#!/bin/bash

set -e

export CLFS=/mnt/lfs
export CLFS_SOURCES=${CLFS}/sources
export CLFS_TOOLS=${CLFS}/tools

export CLFS_HOST=x86_64-cross-linux-gnu
export CLFS_TARGET=x86_64-unknown-linux-gnu
export CFLAGS="-O2 -march=core2"

export NAME_BINUTILS=binutils VERSION_BINUTILS=2.19.1 EXTENSION_BINUTILS=tar.bz2
export NAME_GLIBC=glibc VERSION_GLIBC=2.10.1 EXTENSION_GLIBC=tar.bz2
export NAME_GCC=gcc VERSION_GCC=4.4.1 EXTENSION_GCC=tar.bz2
export NAME_GMP=gmp VERSION_GMP=4.3.1 EXTENSION_GMP=tar.bz2
export NAME_LINUX=linux VERSION_LINUX=2.6.30.1 EXTENSION_LINUX=tar.bz2
export NAME_MPFR=mpfr VERSION_MPFR=2.4.1 EXTENSION_MPFR=tar.bz2

export TARBALL_BINUTILS=${NAME_BINUTILS}-${VERSION_BINUTILS}.${EXTENSION_BINUTILS}
export TARBALL_GLIBC=${NAME_GLIBC}-${VERSION_GLIBC}.${EXTENSION_GLIBC}
export TARBALL_GCC=${NAME_GCC}-${VERSION_GCC}.${EXTENSION_GCC}
export TARBALL_GMP=${NAME_GMP}-${VERSION_GMP}.${EXTENSION_GMP}
export TARBALL_LINUX=${NAME_LINUX}-${VERSION_LINUX}.${EXTENSION_LINUX}
export TARBALL_MPFR=${NAME_MPFR}-${VERSION_MPFR}.${EXTENSION_MPFR}

export SOURCES_BINUTILS=${NAME_BINUTILS}-${VERSION_BINUTILS}
export SOURCES_GLIBC=${NAME_GLIBC}-${VERSION_GLIBC}
export SOURCES_GCC=${NAME_GCC}-${VERSION_GCC}
export SOURCES_GMP=${NAME_GMP}-${VERSION_GMP}
export SOURCES_LINUX=${NAME_LINUX}-${VERSION_LINUX}
export SOURCES_MPFR=${NAME_MPFR}-${VERSION_MPFR}

create_directories() {

	mkdir ${CLFS_TOOLS}/lib64
	mkdir ${CLFS_TOOLS}/usr
	mkdir ${CLFS_TOOLS}/usr/lib64
	mkdir ${CLFS_TOOLS}/usr/local
	mkdir ${CLFS_TOOLS}/usr/local/lib64

	mkdir ${CLFS}/lib64
	mkdir ${CLFS}/usr
	mkdir ${CLFS}/usr/lib64
	mkdir ${CLFS}/usr/local
	mkdir ${CLFS}/usr/local/lib64

}

create_symlinks() {

	cd ${CLFS_TOOLS}
	ln --symbolic lib64 lib
	cd ${CLFS_TOOLS}/usr
	ln --symbolic lib64 lib
	cd ${CLFS_TOOLS}/usr/local
	ln --symbolic lib64 lib

	cd ${CLFS}
	ln --symbolic lib64 lib 
	cd ${CLFS}/usr
	ln --symbolic lib64 lib
	cd ${CLFS}/usr/local
	ln --symbolic lib64 lib

}

install_binutils() {

	cd ${CLFS_SOURCES}
	tar --extract --verbose --file=${TARBALL_BINUTILS}
	mkdir ${NAME_BINUTILS}-build
	cd ${NAME_BINUTILS}-build
	../${SOURCES_BINUTILS}/configure \
	--prefix=${CLFS_TOOLS}/usr \
	--build=${CLFS_HOST} \
	--host=${CLFS_HOST} \
	--target=${CLFS_TARGET} \
	--with-sysroot=${CLFS}
	make
	make install
	cd ${CLFS_SOURCES}
	rm --recursive --force ${SOURCES_BINUTILS}
	rm --recursive --force ${NAME_BINUTILS}-build

}

install_gcc_1() {

	cd ${CLFS_SOURCES}
	tar --extract --verbose --file=${TARBALL_GCC}
	tar --extract --verbose --file=${TARBALL_GMP}
	mv ${SOURCES_GMP} ${SOURCES_GCC}/${NAME_GMP}
	tar --extract --verbose --file=${TARBALL_MPFR}
	mv ${SOURCES_MPFR} ${SOURCES_GCC}/${NAME_MPFR}
	mkdir ${NAME_GCC}-build
	cd ${NAME_GCC}-build
	../${SOURCES_GCC}/configure \
	--prefix=${CLFS_TOOLS}/usr \
	--build=${CLFS_HOST} \
	--host=${CLFS_HOST} \
	--target=${CLFS_TARGET} \
	--with-sysroot=${CLFS} \
	--enable-languages=c \
	--disable-multilib \
	--with-newlib \
	--disable-decimal-float \
	--disable-threads \
	--disable-shared \
	--disable-libmudflap \
	--disable-libssp \
	--disable-libgomp
	make
	make install
	cd ${CLFS_TOOLS}/usr/lib64/gcc/${CLFS_TARGET}/${VERSION_GCC}
	ln --symbolic libgcc.a libgcc_eh.a
	cd ${CLFS_SOURCES}
	rm --recursive --force ${SOURCES_GCC}
	rm --recursive --force ${NAME_GCC}-build

}

install_gcc_2() {

	cd ${CLFS_SOURCES}
	tar --extract --verbose --file=${TARBALL_GCC}
	tar --extract --verbose --file=${TARBALL_GMP}
	mv ${SOURCES_GMP} ${SOURCES_GCC}/${NAME_GMP}
	tar --extract --verbose --file=${TARBALL_MPFR}
	mv ${SOURCES_MPFR} ${SOURCES_GCC}/${NAME_MPFR}
	mkdir ${NAME_GCC}-build
	cd ${NAME_GCC}-build
	../${SOURCES_GCC}/configure \
	--prefix=${CLFS_TOOLS}/usr \
	--build=${CLFS_HOST} \
	--host=${CLFS_HOST} \
	--target=${CLFS_TARGET} \
	--with-sysroot=${CLFS} \
	--enable-languages=c,c++ \
	--disable-multilib
	make
	make install
	cd ${CLFS_SOURCES}
	rm --recursive --force ${SOURCES_GCC}
	rm --recursive --force ${NAME_GCC}-build

}

install_glibc() {

	cd ${CLFS_SOURCES}
	tar --extract --verbose --file=${TARBALL_GLIBC}
	mkdir ${NAME_GLIBC}-build
	cd ${NAME_GLIBC}-build
	../${SOURCES_GLIBC}/configure \
	CC=${CLFS_TOOLS}/usr/bin/${CLFS_TARGET}-gcc \
	--prefix=/usr \
	--build=${CLFS_HOST} \
	--host=${CLFS_TARGET} \
	--with-headers=${CLFS}/usr/include \
	--enable-kernel=2.6.30.1 \
	libc_cv_forced_unwind=yes \
	libc_cv_c_cleanup=yes
	make
	make install install_root=${CLFS}
	cd ${CLFS_SOURCES}
	rm --recursive --force ${SOURCES_GLIBC}
	rm --recursive --force ${NAME_GLIBC}-build

}

install_linux() {

	cd ${CLFS_SOURCES}
	tar --extract --verbose --file=${TARBALL_LINUX}
	cd ${SOURCES_LINUX}
	make INSTALL_HDR_PATH=${CLFS}/usr headers_install
	cd ${CLFS_SOURCES}
	rm --recursive --force ${SOURCES_LINUX}

}

create_directories
create_symlinks
install_linux
install_binutils
install_gcc_1
install_glibc
install_gcc_2

--
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]