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.
The version listed outside of parentheses is the version on the lab machines.
CMakeLists.txt
)src/CMakeLists.txt
)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
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).
Instructions taken from here and here.
git clone --depth 1 https://github.com/llvm/llvm-project.git
.cd llvm-project
, create build directory: mkdir build
, and cd build
.cmake -DCMAKE_INSTALL_PREFIX=<your prefix path> ../llvm
. Additional CMake flags you may wish to add (read more):
-DCMAKE_BUILD_TYPE=Release
: You probably want to add this. Optionally, it may help for lab 4 debugging to set this to RelWithDebInfo
, but it will take 15 - 20 GB of space.-DLLVM_TARGETS_TO_BUILD=X86
: You probably don’t care about compiling for other architectures.make -j <number of parallel jobs, e.g. however many CPU cores you have>
.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).
The other packages can be compiled and installed similarly; generally follow these steps:
build
, e.g. if the project already has a build
folder for other purposes).<source root>/configure --prefix=<your prefix path>
or cmake -DCMAKE_INSTALL_PREFIX=<your prefix path> <path to folder containing CMakeLists.txt (not CMakeLists.txt itself)>
.make -j <number of parallel jobs>
.make install
.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).