UofT ECE 467 (2020 Fall) - Setup

Welcome to the ECE 467 labs homepage for 2020 Fall. See here for the latest version of the course.

Navigation


Setup

For these labs, you may use the ECF machines, where the required software has been installed, or your own Linux virtual machine, where you will likely need to build some dependencies from source. Instructions for both setups are shown below.

If you are SSH-ing into the ECF machines (i.e. ssh <your utorid>@remote.ecf.utoronto.ca), learning to use GNU screen is recommended (a reference is provided below, but google is your friend as well). screen is a terminal multiplexer which 1. allows you to have multiple terminal instances within a single SSH connection; and 2. allows you to detach from your terminal sessions and reattach later.

ECF Machines

  1. Run ecf-sw-env -a ECE467. This will enable the ECE467 environment for your account (you can remove it with ecf-sw-env -r ECE467). You will need to relog for the changes to take effect. Test it by running which bison; it should produce /n/share/copy/ece467/bin/bison
  2. Clone the starter project: git clone http://individual.utoronto.ca/dfr/ece467/ece467-starter.git ece467-<student number 1>-<student number 2>
  3. Create a build directory: mkdir build and cd build
  4. Run cmake: cmake -DCMAKE_PREFIX_PATH=/n/share/copy/ece467 ..
  5. You are now ready to build! Run make
  6. The executable is build/src/ece467c.

    Note: CMake is arguably the de-facto build tool for C++. Although you should not have to edit the CMake files for these labs, it would be useful to learn how it works. You can read more about it starting here.

Your Own Machine

Prerequisites
  1. Basic familiarity with Linux is assumed
  2. Create a directory for your ECE 467 work. These instructions use $HOME/ece467 (quote this path if your $HOME includes spaces). Replace this with whatever path you have chosen. Unless specified otherwise, shell commands should be run in this directory
  3. Create a local prefix path: mkdir $HOME/ece467/prefix
  4. Ensure you are using bash. Usually this is the default shell
  5. Add $HOME/ece467/prefix/bin to your path: PATH=$HOME/ece467/prefix/bin:$PATH. You can add this to your ~/.bashrc to do this automatically on login/new shell
Building a recent version of GCC
  1. Download gcc (10.2.0), gmp (4.3.2), mpfr (3.1.0), and mpc (1.0.1) from a GNU mirror: https://www.gnu.org/prep/ftp.html. You can use wget <url>.
  2. Extract them (tar -xvf <file>). This may take a while
  3. cd into your extracted gcc directory
  4. Create symlinks for gmp, mpfr, and mpc; e.g. ln -s ../gmp-4.3.2 gmp (do the same for mpfr and mpc)
  5. mkdir build and cd build
  6. Run ../configure --prefix=$HOME/ece467/prefix --enable-languages=c++ --disable-multilib
  7. Run make -j 32 (32 parallel jobs). This will take a while (it took me about an hour on the ECF machines, hence why using screen here is recommended, so you can detach, disconnect, and come back later)
  8. Run make install. This will install gcc in $HOME/ece467/prefix/bin
  9. Verify by running which gcc and gcc --version (you should have added $HOME/ece467/prefix/bin to your PATH in the prerequisites)
  10. Your new version of GCC has its own version of GLIBC. Programs compiled with this GCC will be linked to this GLIBC, and will not be able to run as this GLIBC isn't on the system library path (the final steps of installing GCC should have a message about this). Set and export export LD_LIBRARY_PATH=$HOME/ece467/prefix/lib64 so that your new GLIBC can be found (again, you may want to add this to your ~/.bashrc so that it gets set automatically)
Building a recent version of CMake
  1. Download cmake (3.18.2) source: https://cmake.org/download/
  2. Extract and cd into your cmake directory
  3. mkdir build and cd build
  4. Run ../bootstrap -- -DCMAKE_INSTALL_PREFIX=$HOME/ece467/prefix -DCMAKE_BUILD_TYPE=Release ..
  5. Run make -j 32 and make install
  6. Verify by running which cmake and cmake --version
Building LLVM
  1. Get LLVM: git clone https://github.com/llvm/llvm-project. This will take a while
  2. Checkout the 10.0.1 release: git checkout llvmorg-10.0.1
  3. mkdir build and cd build
  4. Run CC=gcc cmake -DCMAKE_INSTALL_PREFIX=$HOME/ece467/prefix -DCMAKE_BUILD_TYPE=RelWithDebInfo ../llvm
  5. Run make -j 32 and make install. As with GCC, this will take a while. Again, screen or tmux are recommended for SSH sessions
Building a recent version of Bison
  1. Download bison (3.6.4): https://www.gnu.org/prep/ftp.html
  2. Extract and cd into your bison directory
  3. mkdir build and cd build
  4. Run ../configure --prefix=$HOME/ece467/prefix
  5. Run make -j 32 and make install
  6. Verify by running which bison and bison --version
Building Flex
  1. Clone the repository: git clone https://github.com/westes/flex
  2. Run ./autogen.sh
  3. mkdir build and cd build
  4. Run ../configure --prefix=$HOME/ece467/prefix
  5. make -j 32 and make install
Building your project

To build your project, follow the instructions above for the ECF machines, replacing /n/share/copy/ece467 with your prefix, i.e. $HOME/ece467 if you followed the instructions verbatim.

GNU screen reference

start a session
screen
detach from a session
ctrl-a d
re-attach to a session
screen -r
forcefully re-attach to a session (detach other sessions)
screen -Dr
create a new window
ctrl-a c
switch to the nth window
ctrl-a <number>
list windows
ctrl-a "

Git reference

clone a repository
git clone <url>
show status of modified files
git status
stage files for commit
git add <files>
add all tracked files for commit
git add -u
commit
git commit
commit with one line message
git commit -m "message"
add your own git server (e.g. GitHub)
git remote add <name> <url>
push to your own git server
git push <name> master