UofT ECE 467 (2022 Fall) - Setting Up a Development Environment on Your Own Linux Machine



The website and starter code is being pre-emptively updated!

I don't know if I'll be teaching the course again, but if I wait until next year I'll forget feedback I've received. Note that more test cases have been added (if you pull the new starter code); those are for the (potential) future!


The ECE UG lab machines contain all the necessary software for the labs. However, here are instructions in case you want/need to set up a development environment on your own computer. A Linux system/VM is required.

Required Software

The version listed outside of parentheses is the version on the lab machines.

Installing Through Your Distro’s Package Manager

The software above can be installed via your distribution’s package manager. All the system packages for the software above should be sufficient if your Linux distribution/version is recent, except for LLVM. The labs assume the latest development version of LLVM (16.0), since LLVM’s default documentation is for its development version (there’s no easy way to switch to documentation for an older version, at least that I know of). Regardless, an older version of LLVM should still work for development purposes, although there may be minor compatibility changes and you should ensure your code works on LLVM 16.0 when you submit. If you choose to use/try your system’s LLVM package, make sure to get the development version with C headers.

Here are the packages for a Red Hat (Fedora) based system.

sudo dnf install make cmake g++ re2c bison llvm-devel readline-devel

Here are the packages for a Debian (e.g. Ubuntu) based system.

sudo apt-get install make cmake g++ re2c bison llvm-dev readline-dev

Notes on Building Custom Software

A prefix path is basically the location software will be installed. The conventional system prefix path (e.g. for package manager-installed software) is /usr. You should not use /usr for custom software. The conventional system prefix path for custom installed software global to the system is /usr/local. You will need root access (i.e. sudo permissions) to install software to /usr/local. Alternatively, you can choose a prefix path anywhere in your home directory; you will not need special permissions to install here. A common local prefix path is ~/.local (where ~ expands to your home directory, i.e.$HOME, by your shell). Personally, I just like to use ~/prefix (equivalently $HOME/prefix) as my prefix path for custom software. This directory does not have to exist prior to installation (most install scripts will create it if it doesn’t already exist, though everything up to the parent directory might need to already exist).

Compiling the Latest Version of LLVM

Instructions taken from here and here.

  1. Clone LLVM source. You do not need the full history: git clone --depth 1 https://github.com/llvm/llvm-project.git.
  2. cd llvm-project, create build directory: mkdir build, and cd build.
  3. Configure: cmake -DCMAKE_INSTALL_PREFIX=<your prefix path> ../llvm. Additional CMake flags you may wish to add (read more):
  4. Build: make -j <number of parallel jobs, e.g. however many CPU cores you have>.
  5. Install: make install (if you chose a system install prefix, you will need to use sudo).

Test that it worked by running <your prefix path>/bin/llvm-config --version; it should return 16.0.0git. When you set up the starter code based on Lab 0, at the cmake step, set -DLLVM_DIR=<your prefix path>/lib/cmake/llvm (instead of the path /cad2/ece467f/prefix/lib/cmake/llvm on the ECE UG machines).

Compiling Other Software

The other packages can be compiled and installed similarly; generally follow these steps:

If you chose /usr/local as your prefix path, executables will be installed in /usr/local/bin, which is usually on your $PATH by default, meaning you can start using the software as is. If you chose something else (e.g. in your home directory) as your prefix path, you will probably need to manually add it to your $PATH and restart your shell/terminal.

echo 'PATH="<your prefix path>/bin:$PATH"' >> ~/.bashrc

After restarting your shell, double check that the software is installed/you have the right version by running <software command> --version (or something similar) (if your system already has a version of the package installed, e.g. through your package manager, and you didn’t install/configure your $PATH properly, you may still be using the system version of the package).


Last updated: 2022-12-23 09:56:36 -0500.