Building MesaPy from Source

Building MesaPy is as easy as building PyPy. Most steps are same with PyPy. But because MesaPy deleted some non-memory-safe module, the number of dependencies of MesaPy are fewer than PyPy.

Clone the repository

Clone the repository and related projects first:

$ git clone -b mesapy2.7 --recursive

This command will clone MesaPy's source code from GitHub and sub-modules such as mesalock-linux/miniz_oxide and mesalock-linux/mesalink.

Install dependencies

Install build-time dependencies, on recent Debian and Ubuntu (16.04 onwards), this is the command to install all build-time dependencies:

$ apt-get install gcc make libffi-dev pkg-config libgdbm-dev libgc-dev python-cffi

Install rust toolchain:

$ curl -sSf | sh

Start building

You can use Makefile to easily build MesaPy. Just one line:

$ make pypy-c

The building time will take about 30 minutes to an hours. Because parallelization of translating MesaPy is not supported, we suggest to use a CPU which with high frequency for a single core.

You can also build the project separately. Basically, it contains two steps: building the Rust projects and translating MesaPy.

Build Rust projects

The Rust projects are under the lib_rust directory. Go to each directory and build the Rust projects. The Rust projects are usually built by cargo. Take miniz_oxide as an example. You can build it by the following command:

$ cd lib_rust/miniz_oxide && cargo build --release
$ cd lib_rust/miniz_oxide && cp target/release/ ../../pypy/goal/

Translate MesaPy

Same as PyPy, both Python and PyPy are supported to translate MesaPy.

$ cd pypy/goal
$ pypy ../../rpython/bin/rpython <rpython options> <pypy options>

Translate with JIT:

$ pypy ../../rpython/bin/rpython --opt=jit <pypy options>

Translate without JIT:

pypy ../../rpython/bin/rpython --opt=2 <pypy options>