Computer Architecture 2015

Tooling prerequisites

Date: September 2015
Author: Raphael 'kena' Poss

Abstract

This note explains how to install the cross-utilities, cross compilers and MGSim simulator. For questions, requests for help, etc., please post on the course's mailing list.

Installing the cross-utilities (as, ld, nm ...)

  1. Get the latest binutils source from https://www.gnu.org/software/binutils/

  2. Configure the binutils for the Alpha ISA:

    tar -xzf ....
    cd ...
    mkdir build-alpha
    cd build-alpha
    ../configure --target=alpha-linux-gnu --disable-werror
        --prefix=/your/install/dir
    

    (Choose a target prefix where you have disk space available. The total tooling may weigh up to 100MB.)

  3. Build & install:

    make
    make install
    
  4. Check the installation was successful:

    export PATH=/your/install/dir/bin:$PATH
    alpha-linux-gnu-as --version
    

    This should report the correct version numbers.

Installing the Alpha cross-compiler

  1. Get the latest GNU C compiler (core package) from http://gcc.gnu.org/

    Then extract the sources:

    tar -xzf ....
    cd ...
    
  2. To build the GNU C compiler, you need to obtain libgmp ( http://gmplib.org/ ), libmpc ( http://www.multiprecision.org/ ) and libmpfr ( http://www.mpfr.org/). The GNU C compiler source code comes with a script to do this for you automatically. In the GNU C compiler source directory you just extracted, run the following command:

    ./contrib/download_prerequisites
    
  3. Configure the GNU C compiler for the Alpha ISA:

    mkdir build-alpha
    cd build-alpha
    ../configure --target=alpha-linux-gnu \
         --disable-bootstrap --disable-libmudflap --disable-libssp \
         --disable-coverage --disable-gdb --disable-lto --disable-threads \
         --disable-nls --disable-multilib --disable-libquadmath \
         --enable-languages=c --prefix=/your/install/dir
    

    (You might need to add the following at the end of the configure command line: CPPFLAGS=-I/path/to/include and LDFLAGS=-L/path/to/lib to indicate where the extra libs from step #1 can be found)

  4. You then need to disable some components manually to simplify the install:

    grep -v 'maybe-[a-z]*-target-\(libgcc\|libiberty\|libgomp\|zlib\|libatomic\)' \
        <Makefile >Makefile.tmp
    mv Makefile.tmp Makefile
    
  5. Build & install:

    make
    make install
    
  6. Check the installation was successful:

    export PATH=/your/install/dir/bin:$PATH
    alpha-linux-gnu-gcc --version
    

    This should report the correct version numbers.

Installing the RISC-V cross-utilities

  1. Make sure the makeinfo and flex commands are available. On Debian and Ubuntu systems these commands are available in the texinfo and flex packages.

  2. Obtain the RISC-V GNU toolchain build scripts:

    git clone -b ca2015 https://github.com/krietvel/riscv-gnu-toolchain
    

    (Place this git repository at a location where you have plenty of disk space. The build will require up to 4GB of space.)

  3. Run configure:

    cd riscv-gnu-toolchain
    ./configure --prefix=/your/install/dir
    
  4. Now you are ready to run make. When you run make, the necessary GCC source code will be downloaded, configured, compiled and installed automatically.

    make
    
  5. Check the installation was successful (note that make install is not required):

    export PATH=/your/install/dir/bin:$PATH
    riscv64-unknown-elf-as --version
    riscv64-unknown-elf-gcc --version
    

Installing MGSim for Alpha

  1. Ensure you have libev ( http://software.schmorp.de/pkg/libev.html ), argp ( standard in GNU C Library, otherwise argp-standalone http://www.lysator.liu.se/~nisse/misc/ ), GNU Make, Autoconf, Automake, Python 2.x ( http://www.python.org/ ) and SDL (http://www.libsdl.org/) installed, with development files.

  2. Obtain the MGSim sources for this course:

    wget http://dist.svp-home.org/deploy/mgsim-3.5.41-3724f.tar.bz2
    

    Then extract the files.

  3. Configure MGSim for the Alpha ISA:

    mkdir build-mtalpha
    cd build-mtalpha
    ../configure --target=mtalpha --disable-trace-checks \
         --prefix=/your/install/dir CXX=your-compliant-c++-compiler
    

    (You might need to add the following at the end of the configure command line: CPPFLAGS=-I/path/to/include and LDFLAGS=-L/path/to/lib to indicate where the extra libs from step #1 can be found)

    Note

    The command c++ or g++ commonly installed on desktop GNU/Linux system may not support ISO C++ 11. MGSim was tested with GNU C++ 4.8+ and LLVM/Clang++ 3.4+. With Clang the best results are obtained by adding -stdlib=libc++ -pthread to CXX.

  4. Build & install:

    make
    make install
    
  5. Check the installation was successful:

    export PATH=/your/install/dir/bin:$PATH
    mtalpha-mgsim --version
    

    This should report the correct version numbers.