Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save steakunderscore/1055352 to your computer and use it in GitHub Desktop.
Save steakunderscore/1055352 to your computer and use it in GitHub Desktop.
How I installed arm-eabi-gcc on Ubuntu 11.04

Install some needed libraries

sudo aptitude install libmpc-dev

Make the temp directory to build in

mkdir toolchain
cd toolchain

Get the required sources

wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
wget -c http://ftp.gnu.org/gnu/gdb/gdb-7.2.tar.gz
wget -c http://ftp.gnu.org/gnu/binutils/binutils-2.21.tar.bz2
wget -c http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/gcc-core-4.6.0.tar.bz2
wget -c http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/gcc-g++-4.6.0.tar.bz2

tar -xvf binutils-2.21.tar.bz2
tar -xvf gcc-core-4.6.0.tar.bz2
tar -xvf newlib-1.19.0.tar.gz
tar -xvf gdb-7.2.tar.gz
tar -xvf 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

sodo 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 --disable-werror
make
sudo 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
sudo 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
sudo make install

Build the final gcc

cd ../../gcc-4.6.0/build-$target
make
sudo make install

Build gdb

cd ../../gdb-7.2
mkdir build-$target
cd build-$target
../configure --target=$target --prefix=$prefix
make
sudo 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.

@rsisto
Copy link

rsisto commented Apr 17, 2012

Hi, this is just what i'm needing, but I found some issues when trying to build gcc...
First, I changed gdb-7.2.tar.gz with gdb-7.4.tar.gz and binutils-2.21.tar.bz2 with binutils-2.22.tar.bz2, since the original packages you mention are not available.
After that, I successfully built binutils, but when trying to build the temporary gcc, when executing 'make all-gcc' I get the following error:

checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make: *** [configure-zlib] Error 1

Did you face this issue? I'll continue looking at it, but maybe you have an answer to this.

Thanks in advance!

@steakunderscore
Copy link
Author

Sorry I'm not going to be any help. I haven't looked at this since I wrote it. But some things you could look into:
Try using gdb-7.2a.tar.gz and binutils-2.21.1a.tar.bz2.

One thing I can tell you is it took me a long time to get working, so that is why I wrote this. Good luck

@rsisto
Copy link

rsisto commented Apr 19, 2012

Thanks for the answer, I actually had problems finding the correct packages for ubuntu 12.04.
Finally, for cross toolchain gcc I installed gcc-4.6-arm-linux-gnueabi package.
For the gdb, gdb-multiarch did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment