public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: James Don <JDon@spacebridge.com>
To: 'Jeff Elkins' <jeffelkins@earthlink.net>
Cc: "'gcc-help@gcc.gnu.org'" <gcc-help@gcc.gnu.org>
Subject: RE: Building a cross-compiler
Date: Mon, 03 Mar 2003 14:33:00 -0000	[thread overview]
Message-ID: <DB0585C9F6F9D411BE8F00D0B7896A4CC06278@SNCMAIL> (raw)

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

Hi Jeff,

Here's a script I slopped together for gcc-2.95.3 from some www sources ... 

I recommend you don't use libstdc++ part of the script ... use what ever stl
etc comes with the g++-core package ... people will just ignore you for the
better part if you have troubles building this and tell you to read the FAQ
etc (which is not really that useful) ...

I'll hopefully clean it up and make a Makefile version later this month when
I have a free moment ...

Hope this helps,
Jim



-----Original Message-----
From: Jeff Elkins [mailto:jeffelkins@earthlink.net] 
Sent: Monday, March 03, 2003 9:28 AM
To: gcc-help@gcc.gnu.org
Subject: Building a cross-compiler

I'm attempting to build a cross-compiler for i686->powerpc using directions
I 
found  at http://www.x86-64.org/documentation_folder/build and  
http://penguinppc.org/embedded/cross-compiling/

I get the error:

config/rs6000/linux.h:81:20: signal.h: No such file or directory
config/rs6000/linux.h:82:26: sys/ucontext.h: No such file or directory
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[2]: Leaving directory `/home/jeff/gcc-3.2.2/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/home/jeff/gcc-3.2.2/gcc'
make: *** [all-gcc] Error 2

Thanks for any assistance,

Jeff Elkins


[-- Attachment #2: buildgcc.sh --]
[-- Type: application/octet-stream, Size: 6649 bytes --]

#!/bin/bash

#
# Get, build and install the latest cross-development tools and libraries
#

#
# Specify the architectures for which the tools are to be built
# To build for multiple targets: ARCHS="m68k ppc i386"
#
ARCHS="powerpc-linux"

#
# Where to install
#
PREFIX=$HOME/ppcgcc/

#
# My kernel includes
#
KERNEL=$HOME/ppclinux/include/

#
# Where to get the GNU tools
#
RTEMS_BINUTILS_URL=ftp://ftp.gnu.org/gnu/binutils/
RTEMS_GCC_URL=ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3/
RTEMS_NEWLIB_URL=ftp://sources.redhat.com/pub/newlib/
GLIBC_URL=ftp://ftp.gnu.org/gnu/glibc
LIBSTDC_URL=ftp://ftp.gnu.org/gnu/libstdc++

#
# Specify the versions
#
GCC_VER=2.95.3
GCC=gcc-core-$GCC_VER
BINUTILS=binutils-2.13.2.1
NEWLIB=newlib-1.10.0
GLIBC_VER=2.2.5

#
# Get the source
#
getSource() {
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_BINUTILS_URL/$BINUTILS.tar.gz
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_BINUTILS_URL/$BINUTILS*.diff

    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_GCC_URL/$GCC.tar.gz
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_GCC_URL/$GCC*.diff

    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_NEWLIB_URL/$NEWLIB.tar.gz
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_NEWLIB_URL/$NEWLIB*.diff
}

getSourceGLIBC() {
    wget --passive-ftp --no-directories --retr-symlinks $GLIBC_URL/glibc-$GLIBC_VER.tar.gz
    wget --passive-ftp --no-directories --retr-symlinks $GLIBC_URL/glibc-$GLIBC_VER*.diff
    wget --passive-ftp --no-directories --retr-symlinks $GLIBC_URL/glibc-linuxthreads-$GLIBC_VER.tar.gz

    

}


#
# UnpackGCC
#
unpackGCC() {

   rm -rf gcc-$GCC_VER
    tar xvfz $GCC.tar.gz
    for d in $GCC*.diff
    do
        if [ -r "$d" ]
        then
            cat "$d" | (cd gcc-$GCC_VER ; patch -p1)
        fi
    done
}

#
# Unpack the source
#
unpackSource() {
    rm -rf $BINUTILS
    tar xvfz $BINUTILS.tar.gz 
    for d in $BINUTILS*.diff
    do
        if [ -r "$d" ]
        then
            cat "$d" | (cd $BINUTILS ; patch -p1)
        fi
    done

    unpackGCC

    rm -rf $NEWLIB
    tar xvfz $NEWLIB.tar.gz
    for d in $NEWLIB*.diff
    do
        if [ -r "$d" ]
        then
            cat "$d" | (cd $NEWLIB ; patch -p1)
        fi
    done
    cd gcc-$GCC_VER 
    ln -s ../$NEWLIB/newlib newlib
    ln -s ../$NEWLIB/libgloss libgloss
    cd ..
}

unpackGLIBC() {

   rm -rf glibc-$GLIBC_VER
   tar xvfz glibc-$GLIBC_VER.tar.gz
   for d in glibc-$GLIBC_VER*.diff
   do
      if [ -r "$d" ]
      then
         cat "$d" | (cd glibc-$GLIBC_VER ; patch -p1)
        fi
    done
    cd glibc-$GLIBC_VER
    tar xvfz ../glibc-linuxthreads-$GLIBC_VER.tar.gz
    cd ..

}

#
# Build
#
build() {
    PATH=$PREFIX/bin:$PATH
    export PATH
    for arch in $ARCHS
    do
        rm -rf BINUTILS
        mkdir BINUTILS
        cd BINUTILS
        ../$BINUTILS/configure --target=$arch --prefix=$PREFIX
	make
        make install
        cd ..

        rm -rf GCC
        mkdir  GCC
        cd GCC
        ../gcc-$GCC_VER/configure --target=$arch --prefix=$PREFIX \
            --with-gnu-as --with-gnu-ld --verbose \
            --with-system-zlib --disable-nls \
            --disable-threads \
	    --disable-shared  \
            --with-newlib \
	    --with-headers=$KERNEL \
            --enable-languages=c

	make
        make install
        cd ..
    done
}

build_glibc() {
    PATH=$PREFIX/bin:$PATH
    export PATH
    for arch in $ARCHS
    do
	rm -rf GLIBC
	mkdir GLIBC
	cd GLIBC
	rm -rf $PREFIX/$arch/include $PREFIX/$arch/sys-include $PREFIX/$arch/lib

        CC=powerpc-linux-gcc AR=powerpc-linux-ar RANLIB=powerpc-linux-ranlib \
                ../glibc-$GLIBC_VER/configure \
	 	--host=$arch \
                --enable-add-ons=linuxthreads \
                --with-headers=$KERNEL  \
                --prefix=$PREFIX/$arch
	make
	make install
	cd ..
   done
}

build_gcc_glibc() {
    PATH=$PREFIX/bin:$PATH
    export PATH
    for arch in $ARCHS
    do

	
	rm -rf GCC_GLIBC
	mkdir GCC_GLIBC
	cd GCC_GLIBC
        ../gcc-$GCC_VER/configure --target=$arch --prefix=$PREFIX/ \
                 --with-gnu-as --with-gnu-ld \
                 --enable-shared \
                 --enable-threads=posix \
                 --enable-languages=c \
                 --with-headers=$KERNEL
	make
        make install
	cd ..


    done
}

getCPPSource() {
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_GCC_URL/gcc-g++-$GCC_VER.tar.gz
    wget --passive-ftp --no-directories --retr-symlinks $RTEMS_GCC_URL/gcc-g++-$GCC_VER*.diff
    wget --passive-ftp --no-directories --retr-symlinks $LIBSTDC_URL/libstdc++-2.90.8.tar.gz
}

unpackCPPSource(){
    pwd
    echo UNPACK G++
    tar xfz gcc-g++-$GCC_VER.tar.gz
}

build_g++_glibc() {
    PATH=$PREFIX/bin:$PATH
    export PATH
    for arch in $ARCHS
    do

	
	rm -rf G++_GLIBC
	mkdir G++_GLIBC
	cd G++_GLIBC
        #cd gcc-$GCC_VER
        ../gcc-$GCC_VER/configure --target=$arch --prefix=$PREFIX \
	    --with-gnu-as --with-gnu-ld \
	    --enable-shared \
	    --enable-threads=posix \
	    --enable-languages=c,c++ \
	    --enable-version-specific-runtime-libs \
	    --with-headers=$KERNEL --with-sysroot=$PREFIX/

	make
        #make install
	cd ..


    done
}

unpackStd() {
    pwd
    echo UNPASK STDC
    tar xfz libstdc++-2.90.8.tar.gz
    patch -p0 -b -z.ORIG < libstdc++-2.90.8-compat-gcc-2.95.3.diff
    cd gcc-$GCC_VER
    mv libstdc++ libstdc++ORIG
    mv libio     libioORIG
    cp -rf ../libstdc++-2.90.8 ./
    mv ./libstdc++-2.90.8 ./libstdc++ 
    cd ..
}


#
# Do everything
#
# Comment out any activities you wish to omit
#
#set -ex

export PATH=$PREFIX/bin/:$PATH

echo ====================================
echo BUILD BOOT STRAPPED COMPILER
echo ====================================
#sleep 10
#getSource
#unpackSource
#unpackCPPSource
#build


echo ====================================
echo BUILD GLIBC
echo ====================================
#getSourceGLIBC
unpackGLIBC
build_glibc

echo ====================================
echo BUILD GCC WITH GLIBC
echo ====================================
unpackGCC
build_gcc_glibc

echo =====================================
echo BUILD G++/GCC WITH GLIBC AND LIBSTC++
echo =====================================
#getCPPSource
#unpackGCC
#unpackCPPSource
#unpackStd
#build_g++_glibc

             reply	other threads:[~2003-03-03 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 14:33 James Don [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-31 15:33 Wenton L. Davis
2008-01-29  4:17 Wenton L. Davis
2008-01-29  4:32 ` John Carter
2008-01-29  4:47   ` Wenton L. Davis
2008-01-29  5:05     ` Michael Witten
2008-01-29  6:54       ` James Tebneff
2008-01-29 20:24       ` Kai Ruottu
2008-01-29  6:11     ` Rupert Wood
2008-01-29  9:58     ` John Carter
2008-01-29 19:04 ` Andrew Haley
2003-03-03 14:28 Jeff Elkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB0585C9F6F9D411BE8F00D0B7896A4CC06278@SNCMAIL \
    --to=jdon@spacebridge.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jeffelkins@earthlink.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).