Skip to content
noahsherrill edited this page Mar 26, 2021 · 1 revision

Build Environment

While we expect FORCE-RISCV should be able to build and run in the majority of Linux environments, there are simply far too many combinations of distributions and packages to even begin to support them all. There have been some valuable contributions to assist with making FORCE-RISCV more compatible with different environments, and more such contributions are always welcome. Below are a few suggestions that may help in getting FORCE-RISCV to build and run in your environment.

Python

FORCE-RISCV links with Python during the build process in order to construct the binding layer between Python and C++. This relies on having some version of the python3-dev package installed. Different Linux distributions use different Python package versions by default, and it is possible to have multiple versions of Python installed. It is important to make sure that the Python version referenced by FORCE_PYTHON_VER and FORCE_PYTHON_INC is the same as the version you see when you run python3 --version. Otherwise, you may see an error indicating FORCE-RISCV was built with a different version than it is being run with when running master_run.

If the python3 command references a different version from the installed Python development library, here are a few suggestions:

  • Run a virtual environment with the same Python version as the Python development library.
  • Set /usr/bin/python3 in your Linux environment to reference the same Python version as the Python development library.
  • Use Docker as described below.

Docker

Docker mitigates environment issues by allowing you to specify the environment you want to run in. The following Dockerfile contents provided below, while not explicitly supported, should generally work. To use it, paste the contents into a file called Dockerfile at the root of the cloned FORCE-RISCV repository. Then run the following commands to build FORCE-RISCV and start an interactive environment in which to run it.

  1. docker build . -t force-riscv
  2. docker run -it force-riscv

Dockerfile

FROM ubuntu:18.04

RUN apt-get -y update
RUN apt-get -y install g++ git make python3 python3-dev

ENV FORCE_CC=/usr/bin/g++
ENV FORCE_PYTHON_VER=3.6
ENV FORCE_PYTHON_LIB=/usr/lib/x86_64-linux-gnu/
ENV FORCE_PYTHON_INC=/usr/include/python3.6

COPY . /app/force-riscv/
WORKDIR /app/force-riscv
RUN make -j
RUN make -j tests

CMD /bin/bash