microsoft/openvmm
Publicmirrored from https://github.com/microsoft/openvmmAvailable
Guide/src/dev_guide/getting_started/build_openvmm.md
111lines · 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 | * * * |
| 10 | |
| 11 | It is strongly suggested that you use WSL2, and [cross compile](./suggested_dev_env.md#wsl2-cross-compiling-from-wsl2-to-windows) |
| 12 | for Windows when necessary. |
| 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 | ### \[Linux] Additional Dependencies |
| 31 | |
| 32 | On Linux, there are various other dependencies you will need depending on what |
| 33 | you're working on. On Debian-based distros such as Ubuntu, running the following |
| 34 | command within WSL will install these dependencies. |
| 35 | |
| 36 | In the future, it is likely that this step will be folded into the |
| 37 | `cargo xflowey restore-packages` command. |
| 38 | |
| 39 | ```bash |
| 40 | $ sudo apt install \ |
| 41 | binutils \ |
| 42 | build-essential \ |
| 43 | gcc-aarch64-linux-gnu \ |
| 44 | libssl-dev |
| 45 | ``` |
| 46 | |
| 47 | ## Building |
| 48 | |
| 49 | OpenVMM uses the standard Rust build system, `cargo`. |
| 50 | |
| 51 | To build OpenVMM, simply run: |
| 52 | |
| 53 | ```sh |
| 54 | cargo build |
| 55 | ``` |
| 56 | |
| 57 | Note that certain features may require compiling with additional `--feature` |
| 58 | flags. |
| 59 | |
| 60 | ## Troubleshooting |
| 61 | |
| 62 | This section documents some common errors you may encounter while building |
| 63 | OpenVMM. |
| 64 | |
| 65 | If you are still running into issues, consider filing an issue on the OpenVMM |
| 66 | GitHub Issue tracker. |
| 67 | |
| 68 | ### failed to invoke protoc |
| 69 | |
| 70 | **Error:** |
| 71 | |
| 72 | ``` |
| 73 | error: failed to run custom build command for `inspect_proto v0.0.0 (/home/daprilik/src/openvmm/support/inspect_proto)` |
| 74 | |
| 75 | Caused by: |
| 76 | process didn't exit successfully: `/home/daprilik/src/openvmm/target/debug/build/inspect_proto-e959f9d63c672ccc/build-script-build` (exit status: 101) |
| 77 | --- stderr |
| 78 | thread 'main' panicked at support/inspect_proto/build.rs:23:10: |
| 79 | 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)" } |
| 80 | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
| 81 | warning: build failed, waiting for other jobs to finish... |
| 82 | ``` |
| 83 | |
| 84 | Note: the specific package that throws this error may vary, and may not always be `inspect_proto` |
| 85 | |
| 86 | **Solution:** |
| 87 | |
| 88 | You attempted to build OpenVMM without first restoring necessary packages. |
| 89 | |
| 90 | Please run `cargo xflowey restore-packages`, and try again. |
| 91 | |
| 92 | ### use of unstable library feature |
| 93 | |
| 94 | **Error:** |
| 95 | |
| 96 | ``` |
| 97 | error[E0658]: use of unstable library feature 'absolute_path' |
| 98 | --> flowey/flowey/src/lib.rs:37:17 |
| 99 | | |
| 100 | 37 | std::path::absolute(self) |
| 101 | | ^^^^^^^^^^^^^^^^^^^ |
| 102 | | |
| 103 | = note: see issue #92750 <https://github.com/rust-lang/rust/issues/92750> for more information |
| 104 | |
| 105 | For more information about this error, try `rustc --explain E0658`. |
| 106 | error: could not compile `flowey` (lib) due to previous error |
| 107 | ``` |
| 108 | |
| 109 | **Solution:** |
| 110 | |
| 111 | Install Rust using the official instructions for [Linux](https://openvmm.dev/dev_guide/getting_started/linux.html#installing-rust) or [Windows](https://openvmm.dev/dev_guide/getting_started/windows.html#installing-rust). |
| 112 | |