Build from source
Setup¶
Before being able to compile the source code, you first have to download it from GitHub. Furthermore, you need Python 3, as well as a common C++ compiler (preferably GCC), CMake and Ninja to build LLVM, which the compiler links against.
The compiler is written in Spice itself. It is built by a released Spice compiler (the stage0 compiler), whose version is
pinned in .github/stage0-version. The build scripts download it for your platform into build/stage0/.
Clone from GitHub¶
Run setup script for setting up your dev environment¶
To build Spice, you can use the dev-setup.py script. This will prepare your dev environment, install the correct LLVM version, download the stage0 compiler and build the Spice executable for the first time to the build directory.
Use¶
Rebuild¶
To build the compiler again after changing its sources in src/, run:
| Bash | |
|---|---|
build/spice. Pass
--build-type Debug for an unoptimized build with debug info.
Bootstrap¶
To check that the compiler builds itself reproducibly, run:
| Bash | |
|---|---|
bootstrap.py builds the compiler from src/ with the stage0 compiler, lets it compile itself until two consecutive builds
are identical, and copies the result to the given path.
Run the tests¶
| Bash | |
|---|---|
test/test-files against it. Pass
--compiler build/spice to test an already built compiler instead, or --filter to select test cases (see --help).
Optional: TPDE backend¶
The experimental TPDE backend needs the TPDE libraries (Linux only). To build them into the std, run:
| Bash | |
|---|---|