From: <bk...@ta...> - 2004-03-12 06:29:42
|
I am working on writing a shell script that is similar to the one found at http://www.libsdl.org/extras/win32/cross/build-cross.sh except that it 1. Builds the cross compiler using the GCC 3.3.3 code 2. Does NOT assume that you only want to use C and C++ (this is my largest problem with all the shell scripts that automate the building of a MinGW cross compiler that I have found so far). 3. It follows the official build scripts from MinGW.org as closely as possible. I am nearly finished with the script. However, I am getting an error when building GCC. The error is as follows (I have attached the make log file): gcc -c -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I/data/downloads/mingw/source/gcc-3.3.3-200402017-1/gcc -I/data/downloads/mingw/source/gcc-3.3.3-200402017-1/gcc/. -I/data/downloads/mingw/source/gcc-3.3.3-200402017-1/gcc/config -I/data/downloads/mingw/source/gcc-3.3.3-200402017-1/gcc/../include /data/downloads/mingw/source/gcc-3.3.3-200402017-1/gcc/gengenrtl.c -o gengenrtl.o make[1]: *** No rule to make target `../libiberty/libiberty.a', needed by `gengenrtl'. Stop. make[1]: Leaving directory `/data/downloads/mingw/gcc-mingw32' make: *** [stage1_build] Error 2 Here is my shell script as it stands now: (I have also attached it to this message) #!/bin/sh # # This is my version of a script to build a MinGW cross compiler. # The primary difference between my version and several others I have seen # (http://www.libsdl.org/extras/win32/cross/build-cross.sh for example) # is I do not arbitrarily decide for you which languages to include. # When configuring GCC I use the same --enable-languages option that is # used in gcc-3.3.3-build.sh from http://www.mingw.org/download.shtml # # Ben Key <bk...@ta...> # MINGW_URL=http://unc.dl.sourceforge.net/sourceforge/mingw/ HOST=i686-pc-linux-gnu # # I know others seem to like using 'i386-mingw32msvc' as the target. I # personally prefer to use the same value for target that is used inI am working on writing a shell script that is similar to the one found at http://www.libsdl.org/extras/win32/cross/build-cross.sh except that it 1. Builds the cross compiler using the GCC 3.3.3 code 2. Does NOT assume that you only want to use C and C++ (this is my largest problem with all the shell scripts that automate the building of a MinGW cross compiler that I have found so far). 3. It follows the official build scripts from MinGW.org as closely as possible. I am nearly finished with the script. However, I am getting an error when building GCC. The error is as follows (I have attached the make log file): # gcc-3.3.3-build.sh. # TARGET=mingw32 # # Where should the MinGW cross compiler be installed? # PREFIX=/usr/local/xmingw32 # # Which languages do you want to use? # LANGUAGES=c,c++,f77,ada,objc,java BINUTILS_VER=2.15.90-20040222-1 GCC_VER=3.3.3-200402017-1 MINGW_RUNTIME_VER=3.2I am working on writing a shell script that is similar to the one found at http://www.libsdl.org/extras/win32/cross/build-cross.sh except that it 1. Builds the cross compiler using the GCC 3.3.3 code 2. Does NOT assume that you only want to use C and C++ (this is my largest problem with all the shell scripts that automate the building of a MinGW cross compiler that I have found so far). 3. It follows the official build scripts from MinGW.org as closely as possible. I am nearly finished with the script. However, I am getting an error when building GCC. The error is as follows (I have attached the make log file): W32API_VER=2.5 BINUTILS_ARCHIVE=binutils-$BINUTILS_VER-src.tar.gz GCC_CORE_ARCHIVE=gcc-core-$GCC_VER-src.tar.gz GCC_ADA_ARCHIVE=gcc-ada-$GCC_VER-src.tar.gz GCC_GPP_ARCHIVE=gcc-g++-$GCC_VER-src.tar.gz GCC_G77_ARCHIVE=gcc-g77-$GCC_VER-src.tar.gz GCC_JAVA_ARCHIVE=gcc-java-$GCC_VER-src.tar.gz GCC_OBJC_ARCHIVE=gcc-objc-$GCC_VER-src.tar.gz GCC_TEST_ARCHIVE=gcc-testsuite-$GCC_VER-src.tar.gz MINGW_RUNTIME_ARCHIVE=mingw-runtime-$MINGW_RUNTIME_VER.tar.gz W32API_ARCHIVE=w32api-$W32API_VER.tar.gz TOPDIR=`pwd` SRCDIR="$TOPDIR/source" BINUTILS_DIR=$SRCDIR/binutils-$BINUTILS_VER BINUTILS_TARGET_DIR=$TOPDIR/binutils-$TARGET GCC_DIR=$SRCDIR/gcc-$GCC_VER GCC_TARGET_DIR=$TOPDIR/gcc-$TARGET report_env_vars() { echo "MINGW_URL = $MINGW_URL" echo "HOST = $HOST" echo "TARGET = $TARGET" echo "PREFIX = $PREFIX" echo "BINUTILS_ARCHIVE = $BINUTILS_ARCHIVE" echo "GCC_CORE_ARCHIVE = $GCC_CORE_ARCHIVE" echo "GCC_ADA_ARCHIVE = $GCC_ADA_ARCHIVE" echo "GCC_GPP_ARCHIVE = $GCC_GPP_ARCHIVE" echo "GCC_G77_ARCHIVE = $GCC_G77_ARCHIVE" echo "GCC_JAVA_ARCHIVE = $GCC_JAVA_ARCHIVE" echo "GCC_OBJC_ARCHIVE = $GCC_OBJC_ARCHIVE" echo "GCC_TEST_ARCHIVE = $GCC_TEST_ARCHIVE" echo "MINGW_RUNTIME_ARCHIVE = $MINGW_RUNTIME_ARCHIVE" echo "W32API_ARCHIVE = $W32API_ARCHIVE" echo "SRCDIR = $SRCDIR" echo "TOPDIR = $TOPDIR" echo "BINUTILS_DIR = $BINUTILS_DIR" echo "GCC_DIR = $GCC_DIR" } # # Make certain wget is installed. # wget is required to download the files from MINGW_URL # check_for_wget() { which wget if [ $? -ne 0 ]; then echo "You need to install wget." exit 1 fi } # # Make certain tar is installed. # tar is required to extract the files downloaded from MINGW_URL # check_for_tar() { which tar if [ $? -ne 0 ]; then echo "You need to install tar." exit 1 fi } # # Make certain gzip is installed. # gzip is required to extract the files downloaded from MINGW_URL # check_for_gzip() { which gzip if [ $? -ne 0 ]; then echo "You need to install gzip." exit 1 fi } remove_previous() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Removing directories from a previous build of xmingw32" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" if [ -d "$PREFIX" ]; then echo "Removing directory $PREFIX" rm -Rdf "$PREFIX" fi if [ -d "$BINUTILS_DIR" ]; then echo "Removing directory $BINUTILS_DIR" rm -Rdf "$BINUTILS_DIR" fi if [ -d "$BINUTILS_TARGET_DIR" ]; then echo "Removing directory $BINUTILS_TARGET_DIR" rm -Rdf "$BINUTILS_TARGET_DIR" fi if [ -d "$GCC_DIR" ]; then echo "Removing directory $GCC_DIR" rm -Rdf "$GCC_DIR" fi if [ -d "$GCC_TARGET_DIR" ]; then echo "Removing directory $GCC_TARGET_DIR" rm -Rdf "$GCC_TARGET_DIR" fi } make_directories() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "making directories" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" mkdir -p "$SRCDIR" mkdir -p "$BINUTILS_TARGET_DIR" mkdir -p "$GCC_TARGET_DIR" mkdir -p "$PREFIX" mkdir -p "$PREFIX/$TARGET" } # # Download a file from a given URL, only if it is not present # This function takes two parameters. # The first parameter is the URL from which to download the file. # The second parameter is the file to download # download_file() { if [ ! -f $2 ]; then echo "Downloading $2" wget "$1/$2" if [ ! -f $2 ]; then echo "Could not download $2" exit 1 fi else echo "The file $2 already exists." fi } download_files() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Downloading files (if required) from $MINGW_URL" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$SRCDIR" download_file "$MINGW_URL" "$BINUTILS_ARCHIVE" download_file "$MINGW_URL" "$GCC_CORE_ARCHIVE" download_file "$MINGW_URL" "$GCC_ADA_ARCHIVE" download_file "$MINGW_URL" "$GCC_GPP_ARCHIVE" download_file "$MINGW_URL" "$GCC_G77_ARCHIVE" download_file "$MINGW_URL" "$GCC_JAVA_ARCHIVE" download_file "$MINGW_URL" "$GCC_OBJC_ARCHIVE" download_file "$MINGW_URL" "$GCC_TEST_ARCHIVE" download_file "$MINGW_URL" "$MINGW_RUNTIME_ARCHIVE" download_file "$MINGW_URL" "$W32API_ARCHIVE" cd "$TOPDIR" } extract_files() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Extracting files" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$SRCDIR" echo "Extracting $BINUTILS_ARCHIVE" tar -zxf "$BINUTILS_ARCHIVE" echo "Extracting $GCC_CORE_ARCHIVE" tar -zxf "$GCC_CORE_ARCHIVE" echo "Extracting $GCC_ADA_ARCHIVE" tar -zxf "$GCC_ADA_ARCHIVE" echo "Extracting $GCC_GPP_ARCHIVE" tar -zxf "$GCC_GPP_ARCHIVE" echo "Extracting $GCC_G77_ARCHIVE" tar -zxf "$GCC_G77_ARCHIVE" echo "Extracting $GCC_JAVA_ARCHIVE" tar -zxf "$GCC_JAVA_ARCHIVE" echo "Extracting $GCC_OBJC_ARCHIVE" tar -zxf "$GCC_OBJC_ARCHIVE" echo "Extracting $GCC_TEST_ARCHIVE" tar -zxf "$GCC_TEST_ARCHIVE" cd "$TOPDIR" } install_libs () { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Installing Libraries" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$PREFIX/$TARGET" pwd echo "Installing $SRCDIR/$MINGW_RUNTIME_ARCHIVE" tar -zxf "$SRCDIR/$MINGW_RUNTIME_ARCHIVE" echo "Installing $SRCDIR/$W32API_ARCHIVE" tar -zxf "$SRCDIR/$W32API_ARCHIVE" } configure_binutils() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Configuring binutils" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$BINUTILS_TARGET_DIR" "$BINUTILS_DIR/configure" --disable-nls --host=$HOST --build=$HOST --target=$TARGET \ --prefix=$PREFIX --with-gcc --with-gnu-as --with-gnu-ld --disable-shared &> configure.log if [ $? -ne 0 ]; then echo "configure failed - log available: $BINUTILS_TARGET_DIR/configure.log" exit 1 fi cd "$TOPDIR" } build_binutils() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Building binutils" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$BINUTILS_TARGET_DIR" make "CFLAGS=-O2 -fno-exceptions" "LDFLAGS=-s" &> make.log if [ $? -ne 0 ]; then echo "make failed - log available: $BINUTILS_TARGET_DIR/make.log" exit 1 fi cd "$TOPDIR" } install_binutils() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Installing binutils" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$BINUTILS_TARGET_DIR" make install &> make-install.log if [ $? -ne 0 ]; then echo "make install failed - log available: $BINUTILS_TARGET_DIR/make-install.log" exit 1 fi cd "$TOPDIR" } make_binutils_symbolic_links() { ln -s "$PREFIX/bin/mingw32-addr2line" "$PREFIX/bin/addr2line" ln -s "$PREFIX/bin/mingw32-ar" "$PREFIX/bin/ar" ln -s "$PREFIX/bin/mingw32-as" "$PREFIX/bin/as" ln -s "$PREFIX/bin/mingw32-c++filt" "$PREFIX/bin/c++filt" ln -s "$PREFIX/bin/mingw32-dlltool" "$PREFIX/bin/dlltool" ln -s "$PREFIX/bin/mingw32-dllwrap" "$PREFIX/bin/dllwrap" ln -s "$PREFIX/bin/mingw32-ld" "$PREFIX/bin/ld" ln -s "$PREFIX/bin/mingw32-nm" "$PREFIX/bin/nm" ln -s "$PREFIX/bin/mingw32-objcopy" "$PREFIX/bin/objcopy" ln -s "$PREFIX/bin/mingw32-objdump" "$PREFIX/bin/objdump" ln -s "$PREFIX/bin/mingw32-ranlib" "$PREFIX/bin/ranlib" ln -s "$PREFIX/bin/mingw32-readelf" "$PREFIX/bin/readelf" ln -s "$PREFIX/bin/mingw32-size" "$PREFIX/bin/size" ln -s "$PREFIX/bin/mingw32-strings" "$PREFIX/bin/strings" ln -s "$PREFIX/bin/mingw32-strip" "$PREFIX/bin/strip" ln -s "$PREFIX/bin/mingw32-windres" "$PREFIX/bin/windres" } configure_gcc() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Configuring GCC" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" # NOTE: For the most part the configure options are identical to the ones used # in gcc-3.3.3-build.sh. I have added several configure options though. My # first addition is the --without-newlib option. All other additions follow # the --without-newlib option. cd "$GCC_TARGET_DIR" "$GCC_DIR/gcc/configure" \ --with-gcc \ --with-gnu-ld \ --with-gnu-as \ --host=$HOST \ --build=$HOST \ --target=$TARGET \ --prefix=$PREFIX \ --enable-threads \ --disable-nls \ --enable-languages=$LANGUAGES \ --disable-win32-registry \ --disable-shared \ --enable-sjlj-exceptions \ --enable-libgcj \ --disable-java-awt \ --without-x \ --enable-java-gc=boehm \ --disable-libgcj-debug \ --enable-interpreter \ --enable-hash-synchronization \ --without-newlib \ --disable-multilib \ --with-headers=$PREFIX/$TARGET/include \ --with-libs=$PREFIX/$TARGET/lib \ &> configure.log if [ $? -ne 0 ]; then echo "configure failed - log available: $GCC_TARGET_DIR/configure.log" exit 1 fi cd "$TOPDIR" } build_gcc() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Building GCC" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$GCC_TARGET_DIR" make "CFLAGS=-O2" "LDFLAGS=-s" bootstrap &> make.log if [ $? -ne 0 ]; then echo "make failed - log available: $GCC_TARGET_DIR/make.log" exit 1 fi cd "$TOPDIR" } install_gcc() { echo "====================================================================" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "Installing GCC" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "====================================================================" cd "$GCC_TARGET_DIR" make install &> make-install.log if [ $? -ne 0 ]; then echo "make failed - log available: $GCC_TARGET_DIR/make-install.log" exit 1 fi } if [ "$1" == "remove" ] ; then remove_previous exit 0 fi report_env_vars check_for_wget check_for_tar check_for_gzip remove_previous make_directories download_files extract_files install_libs configure_binutils build_binutils install_binutils make_binutils_symbolic_links configure_gcc build_gcc install_gcc I would appreciate any help you all might be able to give me in fixing this problem. I would also appreciate any comments or suggestions on my shell script. |