building cross compiler for ppc

David L idht4n@gmail.com
Tue Jan 5 22:00:00 GMT 2010


I need to add fortran support to a cross compiler that my company
uses.  We got the compiler from codesourcery but it lacks fortran
support, so I'm trying to build one from scratch.  First I'm just trying
to replicate the functionality that we currently have (C/C++) cross
compiler from i686-linux to powerpc-linux.  But I can't get that
to compile.  I get this error:


i686-redhat-linux-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
-DGENERATOR_FILE -I. -Ibuild -I/tmp/gccbuild/gcc-4.4.2/gcc
-I/tmp/gccbuild/gcc-4.4.2/gcc/build
-I/tmp/gccbuild/gcc-4.4.2/gcc/../include
-I/tmp/gccbuild/gcc-4.4.2/gcc/../libcpp/include
-I/tmp/gccbuild/objdir/./gmp -I/tmp/gccbuild/gcc-4.4.2/gmp
-I/tmp/gccbuild/objdir/./mpfr -I/tmp/gccbuild/gcc-4.4.2/mpfr
-I/tmp/gccbuild/gcc-4.4.2/gcc/../libdecnumber
-I/tmp/gccbuild/gcc-4.4.2/gcc/../libdecnumber/dpd -I../libdecnumber
-o build/genmodes.o /tmp/gccbuild/gcc-4.4.2/gcc/genmodes.c
/tmp/ccDxF9dK.s: Assembler messages:
/tmp/ccDxF9dK.s:19: Error: Unrecognized opcode: `pushl'
/tmp/ccDxF9dK.s:21: Error: Unrecognized opcode: `movl'
/tmp/ccDxF9dK.s:24: Error: Unrecognized opcode: `subl'
/tmp/ccDxF9dK.s:26: Error: Unrecognized opcode: `movl'
...


Here is what I tried:

cd /tmp
/bin/rm -rf /tmp/gccbuild
/bin/rm -rf /tmp/mygcc
/bin/rm -rf /tmp/mygcc/sysroot
/bin/rm -rf /tmp/mybinutils

mkdir /tmp/gccbuild
mkdir /tmp/mygcc

cd /tmp/gccbuild/
tar -xvjf ~/Download/gcc-4.4.2.tar.bz2
tar -xvjf ~/Download/binutils-2.20.tar.bz2
tar -xvjf ~/Download/gmp-4.3.1.tar.bz2
tar -xvjf ~/Download/mpfr-2.4.2.tar.bz2
cd gcc-4.4.2
ln -s ../mpfr-2.4.2 mpfr
ln -s ../gmp-4.3.1 gmp

cd ../binutils-2.20

./configure --build=i686-redhat-linux --host=i686-redhat-linux
--target=powerpc-linux-gnu --prefix=/tmp/mybinutils
make
make install

cd ..

mkdir objdir
cd objdir

/tmp/gccbuild/gcc-4.4.2/configure --build=i686-redhat-linux \
                                                   --host=i686-redhat-linux \
                                                   --target=powerpc-linux-gnu  \
                                                   --enable-threads \
                                                   --disable-libmudflap \
                                                   --disable-libssp \
                                                   --disable-libstdcxx-pch \
                                                   --with-long-double-128 \
                                                   --with-cpu=603e \
                                                   --enable-secureplt \
                                                   --with-gnu-as --with-gnu-ld \
                                                   --enable-languages=c,c++ \
 --enable-shared --enable-symvers=gnu --enable-__cxa_atexit
--disable-nls --prefix=/tmp/mygcc --enable-libgomp
--enable-poison-system-directories
--with-build-time-tools=/tmp/mybinutils/powerpc-linux-gnu/bin/

make



More information about the Gcc-help mailing list