Open Source Handhelds Workshop

Steve Maddison, April 2011

Alternate Tool Chain Installation

If you're having dependency issues with the tool chain included in the SDK, you can try setting up this one, made by CodeSourcery, often referred to as the "CS Tool Chain". You can get it here (81 MB). The trick is to use this tool chain's compiler with the Pandora libraries in the SDK we just installed.

Installation

Installation is really simple: just unpack the archive to somewhere handy. For this example, we'll use the home directory - you may want to use a different path.

$ tar xjf arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

This creates a directory arm-2009q3 containing the tool chain and really low-level libraries (like libc). As with the SDK before, should you want to remove the tool chain, just delete this directory.

Configuration

Next we need to arrange two things: the alternate tool chain needs to be in our path and we need to set the search paths for headers and libraries. The easiest way to do this is to hack the environment-setup script which came with the SDK (and is therefore installed in /usr/local/angstrom/arm/).

The command path change is simple enough. Edit line 3 to look like this:

export PATH=$HOME/arm-2009q3/bin:$PATH

Now we set a few variables that specify the paths to our headers. At the end of the file, add the following:

export CFLAGS="-I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"

Finally, the library search path is set to check the tool chain's own libraries first, then those of the SDK:

export LDFLAGS="-L$HOME/arm-2009q3/arm-none-linux-gnueabi/libc/usr/lib \
-Wl,-rpath,$HOME/arm-2009q3/arm-none-linux-gnueabi/libc/usr/lib \
-L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib \
-Wl,-rpath,/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib"

If you've run the script before, start a new shell to remove the old values before loading the new ones like before:

. /usr/local/angstrom/arm/environment-setup

NB. All these variables are read in by the configure script we'll be using later to set up the build. However, if the program you want to compile doesn't have such a script, you may need to hack them into the build process manually, for example by editing the Makefile(s).

Using the Tool Chain

The CS tool chain works in the same way as that included in the SDK. It is however named slightly differently: arm-none-linux-gnueabi instead of arm-angstrom-linux-gnueabi. You will therefore need to substitute the old name with this new one for the rest of the tutorial.

Back to the tutorial...


©2011 Steve Maddison
Released under the GNU Free Documentation License.