Bug 40634 - 2 small problems when building cross compiler
Summary: 2 small problems when building cross compiler
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2009-07-03 11:56 UTC by etienne_lorrain
Modified: 2012-02-03 23:15 UTC (History)
2 users (show)

See Also:
Host: i486-pc-linux-gnu
Target: powerpc-unknown-linux-gnu
Build: i486-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description etienne_lorrain 2009-07-03 11:56:49 UTC
On Debian (and probably other), if I execute:
tar xf ../update/gcc-4.4.0.tar.bz2
cd gcc-4.4.0/
tar xf ../../update/mpfr-2.4.1.tar.bz2
tar xf ../../update/gmp-4.3.1.tar.bz2
tar xf ../../update/binutils-2.19.1.tar.bz2
mv gmp-4.3.1 gmp
mv mpfr-2.4.1 mpfr
mv binutils-2.19.1 binutils
mkdir -v ../gcc-build
cd ../gcc-build
mkdir /home/etienne/cross-tools /home/etienne/tools
../gcc-4.4.0/configure --prefix=/home/etienne/cross-tools \
    --host="$(echo $MACHTYPE)" --target="powerpc-unknown-linux-gnu" \
    --disable-multilib --with-local-prefix=/home/etienne/tools \
    --disable-nls --disable-shared --disable-threads --enable-languages=c
make all-gcc

(echo $MACHTYPE gives: i486-pc-linux-gnu)
First error:
if [ x"" != x ]; then \
	  gcc -c -DHAVE_CONFIG_H -g -O2  -I. -I../../gcc-4.4.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic   ../../gcc-4.4.0/libiberty/strncmp.c -o pic/strncmp.o; \
	else true; fi
gcc -c -DHAVE_CONFIG_H -g -O2  -I. -I../../gcc-4.4.0/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  ../../gcc-4.4.0/libiberty/strncmp.c -o strncmp.o
rm -f ./libiberty.a pic/./libiberty.a
i486-pc-linux-gnu-ar rc ./libiberty.a \
	  ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o ./strsignal.o ./unlink-if-ordinary.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o  ./mkstemps.o ./strncmp.o
make[1]: i486-pc-linux-gnu-ar: Command not found
make[1]: *** [libiberty.a] Error 127
make[1]: Leaving directory `/home/etienne/gcc-build/gcc-build/libiberty'
make: *** [all-libiberty] Error 2

If I create i486-pc-linux-gnu-ar pointing to ar in /usr/bin:
# ln -vs /usr/bin/ar /usr/bin/i486-pc-linux-gnu-ar
`/usr/bin/i486-pc-linux-gnu-ar' -> `/usr/bin/ar'
and rerun the same script:

gcc  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -o xgcc gcc.o opts-common.o gcc-options.o gccspec.o \
	  intl.o prefix.o version.o  ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
cp xgcc gcc-cross
gcc -c  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.4.0/gcc -I../../gcc-4.4.0/gcc/. -I../../gcc-4.4.0/gcc/../include -I../../gcc-4.4.0/gcc/../libcpp/include -I/home/etienne/tmp/gcc-build/./gmp -I/home/etienne/tmp/gcc-4.4.0/gmp -I/home/etienne/tmp/gcc-build/./mpfr -I/home/etienne/tmp/gcc-4.4.0/mpfr  -I../../gcc-4.4.0/gcc/../libdecnumber -I../../gcc-4.4.0/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc-4.4.0/gcc/cppspec.c -o cppspec.o
gcc  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -o cpp gcc.o opts-common.o gcc-options.o cppspec.o \
	  intl.o prefix.o version.o  ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
powerpc-unknown-linux-gnu-gcc  -dumpspecs > tmp-specs
/bin/sh: powerpc-unknown-linux-gnu-gcc: command not found
make[1]: *** [specs] Error 127
make[1]: Leaving directory `/home/etienne/tmp/gcc-build/gcc'
make: *** [all-gcc] Error 2

I just need todo:
cd /home/etienne/tmp/gcc-build/gcc
gcc-cross -dumpspecs > tmp-specs
cd ..
make all-gcc
make install-gcc install-binutils

and I get a working compiler.

Exactly the same 2 problems on gcc-4.3.3.

Comment 1 Andrew Pinski 2012-02-03 23:15:20 UTC
> tar xf ../../update/binutils-2.19.1.tar.bz2
> mv binutils-2.19.1 binutils

is not the correct way of doing a combined build.
See http://gcc.gnu.org/wiki/Building_Cross_Toolchains_with_gcc of more info about that.