Install some needed libraries
brew install libmpc
Make the temp directory to build in
mkdir toolchain
cd toolchain
Get the required sources
wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
wget http://ftp.gnu.org/gnu/gdb/gdb-7.2.tar.gz
wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.tar.bz2
wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/gcc-core-4.6.0.tar.bz2
wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/gcc-g++-4.6.0.tar.bz2
extract binutils-2.21.tar.bz2
extract gcc-core-4.6.0.tar.bz2
extract newlib-1.19.0.tar.gz
extract gdb-7.2.tar.gz
extract gcc-g++-4.6.0.tar.bz2
Set up the required variables
export target=arm-eabi
export prefix=/usr/local/$target
export PATH=$prefix/bin:$PATH
Create the bin folder for the final binaries
mkdir -p $prefix/bin
Build binutils
cd binutils-2.21
mkdir build-$target
cd build-$target
../configure --target=$target --prefix=$prefix\
--enable-interwork --enable-multilib
make
make install
Build the temporary gcc to build newlib with. Make sure the --with-headers
line references the version of newlib you downloaded
cd ../../gcc-4.6.0
mkdir build-$target
cd build-$target
../configure --target=$target --prefix=$prefix \
--enable-languages=c,c++ --enable-interwork \
--enable-multilib --with-dwarf2 --with-newlib \
--with-headers=../../newlib-1.19.0/newlib/libc/include
make all-gcc
make install-gcc
Build newlib
cd ../../newlib-1.19.0
mkdir build-$target
cd build-$target
../configure --target=$target --prefix=$prefix --enable-interwork --enable-multilib
make
make install
Build the final gcc
cd ../../gcc-4.6.0/build-$target
make
make install
Build gdb
cd ../../gdb-7.2
mkdir build-$target
cd build-$target
../configure --target=$target --prefix=$prefix
make
make install
Originally blatantly stolen from the Ethernut Project, just documenting my experience with it on a 10.6 Macbook Air with the newest versions of each tool. Since then it has been updated to build the newer eabi
target instead of elf
.
If you get errors to do with warnings being treated as errors you can use --disable-werror
at any of the build steps.