Setting up arm-none-eabi-gcc on Ubuntu 15.04

I went and downloaded gcc for arm from https://launchpad.net/gcc-arm-embedded/+download. I extracted it to /usr/local on a fresh Ubuntu 15.04 install. This creates a directory with the following name
/usr/local/gcc-arm-none-eabi-4_9-2015q2
I find this a bit cumbersome so I usually do a symbolic link to /usr/local/gcc-arm-none-eabi as follows:
ln -s /usr/local/gcc-arm-none-eabi-4_9-2015q2 /usr/local/gcc-arm-none-eabi

Anyway, having done all of that, when I tried to use the compiler I got an error message as follows:
frank@voyager:/usr/local$ arm-none-eabi-gcc –version
bash: /usr/local/gcc-arm-none-eabi/bin/arm-none-eabi-gcc: No such file or directory
This usually means that there is a missing dll that the program relies on. My installation is a 64 bit one however the gcc-arm compiler from launchpad.net is compiled for 32 bit systems. The linux program loader was complaining it couldn’t find the bit versions of libc. This can be fixed as follows:
sudo apt-get install lib32z1 lib32ncurses5
This installs a 32 version of libc (alongside the 64 bit one). The compiler now works fine.
I added the compiler directory to my path by editing the “.profile” file in my home directory. The .profile file now looks like this

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
PATH="$PATH:/usr/local/gcc-arm-none-eabi/bin"

The last line extends the PATH environment variable so that it now points to the directory containing arm-none-eabi-gcc. Each time you login, the .profile file is read and the PATH is set as shown. (if you want the PATH to take immediate effect in the terminal you are currently working in do this: source ~/.profile )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s