Issues in building i686 to mips cross compiler
Darrell Bellert
dbellert@boulder.qms.com
Thu Nov 30 13:36:00 GMT 2000
Hello, I have a couple of concerns in creating a mips-ecoff cross
compiler on RedHat 7.0 that I was hoping someone could address.
First, however, here is the script I used (modeled after section 4.1 of
the FAQ) in order to create the compiler:
-------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
########################################################################################################
#Script to create a cross compiler
########################################################################################################
#<<<<<------------------------- VARIABLES
-------------------------->>>>>
############################################
##### VERSIONS OF UTILITIES TO INSTALL #####
############################################
BINUTILS=binutils-2.10.1 # Name of bin-utils directory
GCC=gcc-2.95.2 # Name of gcc directory
NEWLIB=newlib-1.8.2 # Name of newlib directory
GDB=gdb-5.0 # Name of gdb directory
###################################
##### INSTALLATION PARAMETERS #####
###################################
HOST=i686-pc-linux-gnu # Host machine (machine where you are building
the compiler)
TARGET=mips-ecoff # Target machine (machine for which the compiler
will generate code)
PREFIX=/pika/dbellert/MIPS2 # Root directory for compiler
HEADERS=`pwd`/Include # Target machine header files
LIBS=`pwd`/Lib # Target machine libraries
CC=/usr/bin/gcc # A working C compiler
#<<<<<------------------------- PROCEDURE
-------------------------->>>>>
###########################################################
##### THROW IN SOME BLANK SPACE TO DELINEATE SECTIONS #####
###########################################################
delineate(){
echo
echo
echo
echo $1
echo
"<--------------------------------------------------------------------------------->"
echo
echo
echo
}
#################################################
##### REPORT A CONFIGURATION ERROR AND EXIT #####
#################################################
config_err(){
echo
echo
echo "Error configuring $1"
exit
}
########################################
##### REPORT A MAKE ERROR AND EXIT #####
########################################
make_err(){
echo
echo
echo "Error making $1"
exit
}
###############################################
##### PROCEDURE FOR MAKING CROSS COMPILER #####
###############################################
export CC
PATH=$PATH:$PREFIX/bin
for i in build-binutils build-gcc build-newlib build-gdb
do
if [[ -d $i ]]
then
rm -r $i
fi
mkdir $i
done
cd build-binutils
delineate "CONFIGURING BINUTILS"
../$BINUTILS/configure --host=$HOST --target=$TARGET --prefix=$PREFIX -v
|| config_err BINUTILS
delineate "MAKING BINUTILS"
make all install || make_err BINUTILS
cd ../build-gcc
delineate "CONFIGURING GCC"
../$GCC/configure --host=$HOST --target=$TARGET --prefix=$PREFIX -v
--with-headers=$HEADERS --with-libs=$LIBS --with-gnu-as --with-gnu-ld
--with-newlib || config_err GCC
delineate "MAKING GCC"
make all install || make_err GCC
cd ../build-newlib
delineate "CONFIGURING NEWLIB"
../$NEWLIB/configure --host=$HOST --target=$TARGET --prefix=$PREFIX -v
|| config_err NEWLIB
delineate "MAKING NEWLIB"
make all install || make_err NEWLIB
cd ../build-gdb
delineate "CONFIGURING GDB"
../$GDB/configure --target=$TARGET --prefix=$PREFIX -v || config_err GDB
delineate "MAKING GDB"
make all install || make_err GDB
--------------------------------------------------------------------------------------------------------------------------------------------------------
Here are my concerns:
(1) In order for GCC to build correctly, I had to setup the PATH
variable to include $PREFIX/bin. Without doing this, I would get an
error:
/bin/sh: mips-ecoff-ar: command not found
The reason for this concern is that the FAQ does not mention modifying
the PATH variable until you get to NEWLIB. I just wanted to make sure
that modifying my path did not have any adverse effects that are not
obvious. Any thoughts?
(2) I got three errors while making GCC:
make[3]: Entering directory
`/pika/dbellert/Stuff6/build-gcc/mips-ecoff/libstdc++/testsuite'
make[3]: Leaving directory
`/pika/dbellert/Stuff6/build-gcc/mips-ecoff/libstdc++/testsuite'
make[2]: Leaving directory
`/pika/dbellert/Stuff6/build-gcc/mips-ecoff/libstdc++'
make[1]: Leaving directory
`/pika/dbellert/Stuff6/build-gcc/mips-ecoff/libstdc++'
Configuring in mips-ecoff/libf2c
creating cache ./config.cache
checking if compiler f771 has been built... yes
checking for gcc... /home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/
checking whether the C compiler
(/home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/ -g -O2 ) works... no
configure: error: installation or configuration problem: C compiler
cannot create executables.
Configuring in mips-ecoff/libchill
creating cache ./config.cache
checking if compiler cc1chill has been built... yes
checking for gcc... /home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/
checking whether the C compiler
(/home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/ -g -O2 ) works... no
configure: error: installation or configuration problem: C compiler
cannot create executables.
Configuring in mips-ecoff/libobjc
creating cache ./config.cache
checking if compiler cc1obj has been built... yes
checking for gcc... /home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/
checking whether the C compiler
(/home/dbellert/Stuff6/build-gcc/gcc/xgcc
-B/home/dbellert/Stuff6/build-gcc/gcc/
-B/home/dbellert/Stuff6/Build/mips-ecoff/bin/ -g -O2 ) works... no
configure: error: installation or configuration problem: C compiler
cannot create executables.
/bin/sh ../gcc-2.95.2/mkinstalldirs /home/dbellert/Stuff6/Build
/home/dbellert/Stuff6/Build
Even though installation ultimately completed, is there any reason for
concern for the above errors (configure: error: installation or
configuration problem: C compiler cannot create executables.)?
(3) I got numerous warnings during the make process (about 4300). Is
this normal or should this also be a cause for concern?
If anyone has any comments for these concerns, please share.
Thanks,
Darrell
More information about the Gcc-help
mailing list