csd
csd

Reputation: 944

How to use both 4.5 and 4.6 versions of arm gcc in Ubuntu?

using Ubuntu 12 to cross compile arm code provides 2 gcc versions, 4.5 and 4.6. Installing both creates symlinks from the tools to the 4.6 version (e.g. arm-linux-gnueabi-gcc -> arm-linux-gnueabi-gcc-4.6). Is there an easy way to switch back and forth from having e.g. gcc symlinked to 4.5 or 4.6 ? I can write scripts that hack away at the symlinks but I'm hoping there's an Ubuntu way to do that already. thanks!

Upvotes: 0

Views: 1047

Answers (2)

sgupta
sgupta

Reputation: 1272

A better and cleaner approach imho (and exactly what i do) is:

  1. Get the archive version, (Do not use apt)
  2. extract it in your home or /usr/share
  3. Create some alias in your ~/.bashrc like

    alias sourcery2009 = 'CROSS_COMPILE=/usr/share/arm-2009q3/bin/arm-none-eabi-'
    alias sourcery2010 = 'CROSS_COMPILE=/usr/share/arm-2010q1/bin/arm-none-eabi-'
    
  4. When compiling (linux), use make zImage sourcery2009, this step varies a lot depending on what project you're compiling and how they take the location/prefix about the toolchain you want them to use, For many projects with simple makefiles, you'd have to do edits in makefile to change the path or make it take the toolchain path as an arg.

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798616

The alternatives system allows you to have a symlink you can swing around at will.

Upvotes: 1

Related Questions