You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GenMC](https://github.com/MPI-SWS/genmc) is a stateless model checker for exploring concurrent executions of a program.
4
+
Miri-GenMC integrates that model checker into Miri.
3
5
4
6
**NOTE: Currently, no actual GenMC functionality is part of Miri, this is still WIP.**
5
7
6
8
<!-- FIXME(genmc): add explanation. -->
7
9
8
10
## Usage
9
11
10
-
**IMPORTANT: The license of GenMC and thus the `genmc-sys` crate in the Miri repo is currently "GPL-3.0-or-later", which is NOT compatible with Miri's "MIT OR Apache" license.**
11
-
12
-
**IMPORTANT: There should be no distribution of Miri-GenMC until all licensing questions are clarified (the `genmc` feature of Miri is OFF-BY-DEFAULT and should be OFF for all Miri releases).**
12
+
**IMPORTANT: The license of GenMC and thus the `genmc-sys` crate in the Miri repo is currently "GPL-3.0-or-later", so a binary produced with the `genmc` feature is subject to the requirements of the GPL. As long as that remains the case, the `genmc` feature of Miri is OFF-BY-DEFAULT and must be OFF for all Miri releases.**
13
13
14
14
For testing/developing Miri-GenMC (while keeping in mind the licensing issues):
15
15
- clone the Miri repo.
@@ -35,44 +35,28 @@ Some or all of these limitations might get removed in the future:
35
35
36
36
- Borrow tracking is currently incompatible (stacked/tree borrows).
GenMC is written in C++, which complicates development a bit.
46
-
For Rust-C++ interop, Miri uses [CXX.rs](https://cxx.rs/), and all handling of C++ code is contained in the `genmc-sys` crate (located in the Miri repository root directory: `miri/genmc-sys/`).
47
-
48
-
Building GenMC requires a compiler with C++23 support.
49
-
<!-- FIXME(genmc,llvm): remove once LLVM dependency is no longer required. -->
50
-
Currently, building GenMC also requires linking to LLVM, which needs to be installed manually.
51
-
52
-
The actual code for GenMC is not contained in the Miri repo itself, but in a [separate GenMC repo](https://github.com/MPI-SWS/genmc) (with different maintainers).
53
-
Note that this repo is just a mirror repo.
54
-
<!-- FIXME(genmc): define how submitting code to GenMC should be handled. -->
46
+
The prerequisites for building Miri-GenMC are:
47
+
- A compiler with C++23 support.
48
+
- LLVM developments headers and clang.
49
+
<!-- FIXME(genmc,llvm): remove once LLVM dependency is no longer required. -->
50
+
51
+
The actual code for GenMC is not contained in the Miri repo itself, but in a [separate GenMC repo](https://github.com/MPI-SWS/genmc) (with its own maintainers).
52
+
These sources need to be available to build Miri-GenMC.
53
+
The process for obtaining them is as follows:
54
+
- By default, a fixed commit of GenMC is downloaded to `genmc-sys/genmc-src` and built automatically.
55
+
(The commit is determined by `GENMC_COMMIT` in `genmc-sys/build.rs`.)
56
+
- If you want to overwrite that, set the `GENMC_SRC_PATH` environment variable to a path that contains the GenMC sources.
57
+
If you place this directory inside the Miri folder, it is recommended to call it `genmc-src` as that tells `./miri fmt` to avoid
58
+
formatting the Rust files inside that folder.
59
+
60
+
<!-- FIXME(genmc): explain how submitting code to GenMC should be handled. -->
55
61
56
62
<!-- FIXME(genmc): explain development. -->
57
-
58
-
### Building the GenMC Library
59
-
The build script in the `genmc-sys` crate handles locating, downloading, building and linking the GenMC library.
60
-
61
-
To determine which GenMC repo path will be used, the following steps are taken:
62
-
- If the env var `GENMC_SRC_PATH` is set, it's value is used as a path to a directory with a GenMC repo (e.g., `GENMC_SRC_PATH="path/to/miri/genmc-sys/genmc-sys-local"`).
63
-
- Note that this variable must be set wherever Miri is built, e.g., in the terminal, or in the Rust Analyzer settings.
64
-
- If the path `genmc-sys/genmc-src/genmc` exists, try to set the GenMC repo there to the commit we need.
65
-
- If the downloaded repo doesn't exist or is missing the commit, the build script will fetch the commit over the network.
66
-
- Note that the build script will *not* access the network if any of the steps previous steps succeeds.
67
-
68
-
Once we get the path to the repo, the compilation proceeds in two steps:
69
-
- Compile GenMC into a library (using cmake).
70
-
- Compile the cxx.rs bridge to connect the library to the Rust code.
71
-
The first step is where all build settings are made, the relevant ones are then stored in a `config.h` file that can be included in the second compilation step.
72
-
73
-
#### Code Formatting
74
-
Note that all directories with names starting with `genmc-src` are ignored by `./miri fmt` on purpose.
75
-
GenMC also contains Rust files, but they should not be formatted with Miri's formatting rules.
76
-
For working on Miri-GenMC locally, placing the GenMC repo into such a path (e.g., `miri/genmc-sys/genmc-src-local`) ensures that it is also exempt from formatting.
77
-
78
-
<!-- FIXME(genmc): Decide on formatting rules for Miri-GenMC interface C++ code. -->
/// Name of the library of the GenMC model checker.
12
12
constGENMC_MODEL_CHECKER:&str = "genmc_lib";
@@ -122,11 +122,9 @@ mod downloading {
122
122
return;
123
123
}
124
124
125
-
println!(
126
-
"HINT: For local development, set the environment variable 'GENMC_SRC_PATH' to the path of a GenMC repository.",
127
-
);
128
125
panic!(
129
-
"Downloaded GenMC repository at path '{GENMC_DOWNLOAD_PATH}' has been modified. Please undo any changes made, or delete the '{GENMC_DOWNLOAD_PATH}' directory to have it downloaded again."
126
+
"Downloaded GenMC repository at path '{GENMC_DOWNLOAD_PATH}' has been modified. Please undo any changes made, or delete the '{GENMC_DOWNLOAD_PATH}' directory to have it downloaded again.\n\
127
+
HINT: For local development, set the environment variable 'GENMC_SRC_PATH' to the path of a GenMC repository."
0 commit comments