|
| 1 | +# RMC Installation Guide |
| 2 | + |
| 3 | +RMC must currently be built from source. |
| 4 | + |
| 5 | +In general, the following dependencies are required: |
| 6 | + |
| 7 | +1. The dependencies needed to built `rustc`. RMC is a fork of the Rust compiler, and so we have the same minimum requirements. |
| 8 | +2. [CBMC](https://github.com/diffblue/cbmc) (>= 5.30.1) |
| 9 | +3. [CBMC Viewer](https://github.com/awslabs/aws-viewer-for-cbmc) (>= 2.6) |
| 10 | + |
| 11 | +## Installing on Ubuntu 20.04 |
| 12 | + |
| 13 | +The simplest way to install (especially if you're using a fresh VM) is following our CI scripts: |
| 14 | + |
| 15 | +``` |
| 16 | +# git clone git@github.com:model-checking/rmc.git |
| 17 | +git clone https://github.com/model-checking/rmc.git |
| 18 | +cd rmc |
| 19 | +git submodule update --init |
| 20 | +./scripts/setup/ubuntu-20.04/install_deps.sh |
| 21 | +./scripts/setup/ubuntu-20.04/install_cbmc.sh |
| 22 | +./scripts/setup/install_viewer.sh 2.6 |
| 23 | +./scripts/setup/install_rustup.sh |
| 24 | +``` |
| 25 | + |
| 26 | +## Installing on Mac OS |
| 27 | + |
| 28 | +You need to have [Homebrew](https://brew.sh/) installed already. |
| 29 | + |
| 30 | +``` |
| 31 | +# git clone git@github.com:model-checking/rmc.git |
| 32 | +git clone https://github.com/model-checking/rmc.git |
| 33 | +cd rmc |
| 34 | +git submodule update --init |
| 35 | +./scripts/setup/macos-10.15/install_deps.sh |
| 36 | +./scripts/setup/macos-10.15/install_cbmc.sh |
| 37 | +./scripts/setup/install_viewer.sh 2.6 |
| 38 | +./scripts/setup/install_rustup.sh |
| 39 | +``` |
| 40 | + |
| 41 | +## Building and testing RMC |
| 42 | + |
| 43 | +Perform one-time build configuration: |
| 44 | + |
| 45 | +``` |
| 46 | +./configure \ |
| 47 | + --enable-debug \ |
| 48 | + --set=llvm.download-ci-llvm=true \ |
| 49 | + --set=rust.debug-assertions-std=false \ |
| 50 | + --set=rust.deny-warnings=false |
| 51 | +``` |
| 52 | + |
| 53 | +**NOTE: If you skip the above (`llvm.download-ci-llvm=true` specifically), builds may take a long time as all of LLVM would need to be built from scratch.** |
| 54 | + |
| 55 | +Then build RMC: |
| 56 | + |
| 57 | +``` |
| 58 | +./x.py build -i --stage 1 library/std |
| 59 | +``` |
| 60 | + |
| 61 | +Then, optionally, run the regression tests: |
| 62 | + |
| 63 | +``` |
| 64 | +./scripts/rmc-regression.sh |
| 65 | +``` |
| 66 | + |
| 67 | +This script has a lot of noisy output, but on a successful run you will see: |
| 68 | + |
| 69 | +``` |
| 70 | +All RMC regression tests completed successfully. |
| 71 | +``` |
| 72 | + |
| 73 | +## Try running RMC |
| 74 | + |
| 75 | +Get the RMC script in your path: |
| 76 | + |
| 77 | +```bash |
| 78 | +export PATH=$(pwd)/scripts:$PATH |
| 79 | +``` |
| 80 | + |
| 81 | +Create a test file: |
| 82 | + |
| 83 | +```rust |
| 84 | +// File: test.rs |
| 85 | +fn main() { |
| 86 | + assert!(1 == 2); |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +Run RMC on the single file: |
| 91 | + |
| 92 | +``` |
| 93 | +rmc test.rs |
| 94 | +``` |
| 95 | + |
| 96 | +You should get a result like this one: |
| 97 | + |
| 98 | +``` |
| 99 | +[snipped output] |
| 100 | +** Results: |
| 101 | +test.rs function main |
| 102 | +[main.assertion.1] line 2 assertion failed: 1 == 2: FAILURE |
| 103 | +
|
| 104 | +** 1 of 1 failed (2 iterations) |
| 105 | +VERIFICATION FAILED |
| 106 | +``` |
| 107 | + |
| 108 | +Fix the test and you should see `rmc` succeed. |
0 commit comments