microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
Guide/src/dev_guide/getting_started/build_openvmm.md
94lines · modecode
| 1 | # Building OpenVMM |
| 2 | |
| 3 | **Prerequisites:** |
| 4 | |
| 5 | - One of: |
| 6 | - [Getting started on Windows](./windows.md) |
| 7 | - [Getting started on Linux / WSL2](./linux.md). |
| 8 | |
| 9 | ```admonish tip |
| 10 | It is strongly suggested that you use WSL2, and [cross compile](./cross_compile.md) |
| 11 | for Windows when necessary. |
| 12 | ``` |
| 13 | |
| 14 | ## Build Dependencies |
| 15 | |
| 16 | OpenVMM currently requires a handful of external dependencies to be present in |
| 17 | order to properly build / run. e.g: a copy of `protoc` to compile Protobuf |
| 18 | files, a copy of the `mu_msvm` UEFI firmware, some test linux kernels, etc... |
| 19 | |
| 20 | Running the following command will fetch and unpack these various artifacts into |
| 21 | the correct locations within the repo: |
| 22 | |
| 23 | ```sh |
| 24 | cargo xflowey restore-packages |
| 25 | ``` |
| 26 | |
| 27 | If you intend to cross-compile, refer to the command's `--help` for additional |
| 28 | options related to downloading packages for other architectures. |
| 29 | |
| 30 | ## Building |
| 31 | |
| 32 | OpenVMM uses the standard Rust build system, `cargo`. |
| 33 | |
| 34 | To build OpenVMM, simply run: |
| 35 | |
| 36 | ```sh |
| 37 | cargo build |
| 38 | ``` |
| 39 | |
| 40 | Note that certain features may require compiling with additional `--feature` |
| 41 | flags. |
| 42 | |
| 43 | ## Troubleshooting |
| 44 | |
| 45 | This section documents some common errors you may encounter while building |
| 46 | OpenVMM. |
| 47 | |
| 48 | If you are still running into issues, consider filing an issue on the OpenVMM |
| 49 | GitHub Issue tracker. |
| 50 | |
| 51 | ### failed to invoke protoc |
| 52 | |
| 53 | **Error:** |
| 54 | |
| 55 | ```text |
| 56 | error: failed to run custom build command for `inspect_proto v0.0.0 (/home/daprilik/src/openvmm/support/inspect_proto)` |
| 57 | |
| 58 | Caused by: |
| 59 | process didn't exit successfully: `/home/daprilik/src/openvmm/target/debug/build/inspect_proto-e959f9d63c672ccc/build-script-build` (exit status: 101) |
| 60 | --- stderr |
| 61 | thread 'main' panicked at support/inspect_proto/build.rs:23:10: |
| 62 | called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): (path: \"/home/daprilik/src/openvmm/.packages/Google.Protobuf.Tools/tools/protoc\"): No such file or directory (os error 2)" } |
| 63 | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
| 64 | warning: build failed, waiting for other jobs to finish... |
| 65 | ``` |
| 66 | |
| 67 | Note: the specific package that throws this error may vary, and may not always be `inspect_proto` |
| 68 | |
| 69 | **Solution:** |
| 70 | |
| 71 | You attempted to build OpenVMM without first restoring necessary packages. |
| 72 | |
| 73 | Please run `cargo xflowey restore-packages`, and try again. |
| 74 | |
| 75 | ### use of unstable library feature |
| 76 | |
| 77 | **Error:** |
| 78 | |
| 79 | ```text |
| 80 | error[E0658]: use of unstable library feature 'absolute_path' |
| 81 | --> flowey/flowey/src/lib.rs:37:17 |
| 82 | | |
| 83 | 37 | std::path::absolute(self) |
| 84 | | ^^^^^^^^^^^^^^^^^^^ |
| 85 | | |
| 86 | = note: see issue #92750 <https://github.com/rust-lang/rust/issues/92750> for more information |
| 87 | |
| 88 | For more information about this error, try `rustc --explain E0658`. |
| 89 | error: could not compile `flowey` (lib) due to previous error |
| 90 | ``` |
| 91 | |
| 92 | **Solution:** |
| 93 | |
| 94 | Install Rust using the official instructions for [Linux](https://openvmm.dev/guide/dev_guide/getting_started/linux.html#installing-rust) or [Windows](https://openvmm.dev/guide/dev_guide/getting_started/windows.html#installing-rust). |
| 95 | |