Skip to content

Install TransProc Compiler Toolchain

Xiaoguang Wang edited this page May 3, 2022 · 3 revisions

This section shows how to build and install the TransProc compiler toolchain used to build migrate-able benchmarks.

Build the compiler using Docker (recommended)

First, you need to install docker. You can find the method to install docker on ubuntu here.

Next, you can directly use a pre-built docker image:

docker pull xgwang9/popcorn-compiler:TransProc

Alternatively, you can also download the Dockerfile for popcorn-compiler. Find the Dockerfile here, or download the entire popcorn-compiler repository as follows:

git clone -b stack_pop --single-branch https://github.com/ssrg-vt/popcorn-compiler.git
cd popcorn-compiler/docker
docker build -t popcorn-compiler:TransProc .

Last, you can build a test application using the docker image built from the 2nd step. Consider the application to be built is in ./app, build the application with:

❯ ls ./app
Makefile test.c
❯ docker run --rm --user "$(id -u):$(id -g)" \
    -v $(pwd)/app:/code/app popcorn-compiler:TransProc \
    make -C /code/app
make: Entering directory '/code/app'
 [MKDIR] build_aarch64/
 [CC] test.c
 [LD] build_aarch64/test_aarch64 (vanilla)
 [MKDIR] build_x86-64/
 [LD] build_x86-64/test_x86-64 (vanilla)
 [ALIGN] build_aarch64/aligned_linker_script_arm.x
 [LD] test_aarch64 (aligned)
 [ALIGN] build_x86-64/aligned_linker_script_x86.x
 [LD] test_x86-64 (aligned)
 [POST_PROCESS] test_aarch64 test_x86-64
make: Leaving directory '/code/app'
❯ ls ./app
build_aarch64  build_x86-64  Makefile  test_aarch64  test_aarch64.o  test.c  test_x86-64  test_x86_64.o

Build the compiler locally

Clone popcorn compiler and checkout the stack_pop branch locally.

Install all the popcorn compiler prerequisites and run

python3 install_compiler.py --install-all

This will take a while and will build and install the TransProc compiler toolchain required to build binaries that can be migrated on the TransProc environment. The toolchain will be installed under /usr/local/stack_pop/.

Create a softlink of the stack_pop directory and call it popcorn.

sudo ln -s /usr/local/stack_pop/ /usr/local/popcorn

This is necessary as we have configured the compiler name as popcorn, in the benchmark makefile recipes.