Problems to build a cross compiler under Linux
karim
bernardet.karim@wanadoo.fr
Tue Nov 19 11:33:00 GMT 2002
Hello !
I want to have under linux a compiler which produces binaries for windows
(with cygwin). So I try cross compiling. I use the script below to do that
and I use binutils-20021107-2, gcc-3.2-3, newlib-1.9.0 and cygwin-1.3.15-2
for the headers. The compilation was successfull (but I had to move some
headers files) but when I try to compile a simple hello.c :
/home/karimb/cross/build/bin/i686-cygwin32-gcc hello.c, I got this error :
./../lib/gcc-lib/i686-cygwin32/3.2/../../../../i686-cygwin32/bin/ld: ne peut
trouver -lcygwin
collect2: ld a retourné 1 code d'état d'exécution
(sorry for the french language)
so it can t find a cygwin library ...
Thanks for your help ...
Karim
#!/bin/sh
############################################################################
############################
#Script to create a cross compiler
############################################################################
############################
#<<<<<------------------------- VARIABLES-------------------------->>>>>
############################################
##### VERSIONS OF UTILITIES TO INSTALL #####
############################################
BINUTILS=binutils-20021107-2 # Name of bin-utils directory
GCC=gcc-3.2-3 # Name of gcc directory
NEWLIB=newlib-1.9.0 # Name of newlib directory
###################################
##### INSTALLATION PARAMETERS #####
###################################
HOST=i686-pc-linux-gnu # Host machine (machine where you
are buildingthe compiler)
TARGET=i686-cygwin32 # Target machine (machine for
which the compilerwill generate code)
PREFIX=/home/karimb/cross/build # 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-h
eaders=$HEADERS --with-libs=$LIBS --with-gnu-as --with-gnu-ld --with-newlib
--enable-languages="c,c++" || 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
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list