How To Update To LegUp-3.5

Last Author
Last Updated
1281 Days Ago

How To Update to LegUp 3.5

This page describes how to switch branches from the current master (with LLVM 2.9) to the llvm-3.5 branch (with LLVM 3.5).

1. Install dependencies

Get dependencies: gcc and clang

1.1 GCC

This procedure will differ depending on the version of Ubuntu you have.

If you are running Ubuntu 14.04 or later:

sudo apt-get install qemu-system-arm gcc-4.8-plugin-dev

If you are running Ubuntu < 14.04:

You have two options: install gcc-4.8 or use gcc-4.7. Using gcc-4.7 is probably easier.

a) Use gcc-4.7

Get gcc-4.7-plugin-dev:

sudo apt-get install gcc-4.7-plugin-dev

Edit legup/Makefile and change:




Make sure both gcc --version and g++ --version show version 4.7.

b) Use gcc-4.8

Warning: Be careful running these commands. Don't run them if they remove hundreds of your existing packages. They didn't work for me on Ubuntu 12.10

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install qemu-system-arm gcc-4.8-plugin-dev g++4.8 gcc-4.8-multilib
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50


1.2 Clang

This procedure will differ depending on whether you have a 32- or 64-bit system.


Get clang 3.5 and add it to your $PATH

cd ~
tar xfJv clang+llvm-3.5.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
rm clang+llvm-3.5.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
cd clang+llvm-3.5.0-x86_64-linux-gnu/bin
ln -s clang clang-3.5
ln -s clang clang-3.5++
echo "export PATH=\$PATH:`pwd`/" >> ~/.bashrc
source ~/.bashrc


There is no clang binary for 32-bit systems. If your system is 32-bit this will not work. You can try using clang 3.4 which should work:

sudo apt-get install clang-3.4



or build clang 3.5 from source:

2. git checkout

Get the llvm-3.5 branch.

You have two options here. My preference is Option 2.

2.1 Option 1: Single branch 'llvm-3.5'

Go to your legup directory (mine is ~/legup), pull and checkout the llvm-3.5 branch

cd ~/legup
make clean
git pull
git checkout llvm-3.5
NOTE: if you get a warning about uncommitted files, or files that may get overwritten, you may want to commit/stash your changes, then attempt the checkout again.

To check which branch you are on run:

git branch

Any changes you commit or push while you are on the llvm-3.5 branch will only exist in the llvm-3.5 branch until you merge them back to the main (master) branch.

To go back to the main (master) branch run:

git checkout master

2.2 Option 2: Concurrent 'master' and 'llvm-3.5' branches

I find it handy to have both the current master branch and llvm-3.5 branch on my machine at the same time.
This allows you to switch between the two branches by switching directories, rather than recompiling all of legup.
The following instructions will create a new directory called legup-3.5 that is an entire copy of legup.
This way you run tests, etc, in 'master' and 'llvm-3.5' at the same time, and make sure they both function the same.

cd ~
git clone legup-3.5
cd legup-3.5
git checkout llvm-3.5

3. make llvm-3.5

cd ~/legup
make clean
make -j4


cd ~/legup-3.5
make clean
make -j4

This will take some time.

4. test

cd examples
make check

If you run into any errors along the way Please email Bain, and/or update this wiki.

How to Get LegUp 3.5 Working on EECG Machines

Use clang-3.3

The clang-3.5 binaries from do not work on the EECG machines due to library issues.
Luckily we can use clang-3.3 instead.
I used this one: with good results.

tar -xvf clang+llvm-3.3-amd64-Ubuntu-10.04.4.tar.gz
cd clang+llvm-3.3-amd64-Ubuntu-10.04.4/bin
ln -s clang clang-3.3
ln -s clang++ clang-3.3++

Once you have unzipped clang-3.3 you will need to add it to your $PATH, and create the simlinks clang-3.3 and clang-3.3++.

Also, make sure you change the clang-3.5 to clang-3.3 for FRONT_END and FRONT_END_PP in:

Use GCC 4.7

The EECG machines do not have gcc-4.8, but gcc-4.7 works fine.

In legup/Makefile, change:




Verify that gcc and g++ are at version 4.7:

$ gcc --version
gcc (Debian 4.7.2-5) 4.7.2

$ g++ --version
g++ (Debian 4.7.2-5) 4.7.2