microsoft/openvmm

Public

mirrored from https://github.com/microsoft/openvmmAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
72af67f6f4d9d042a32318a024b4ccb612bbd2db

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

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
11It is strongly suggested that you use WSL2, and [cross compile](./suggested_dev_env.md#wsl2-cross-compiling-from-wsl2-to-windows)
12for Windows when necessary.
13
14## Build Dependencies
15
16OpenVMM currently requires a handful of external dependencies to be present in
17order to properly build / run. e.g: a copy of `protoc` to compile Protobuf
18files, a copy of the `mu_msvm` UEFI firmware, some test linux kernels, etc...
19
20Running the following command will fetch and unpack these various artifacts into
21the correct locations within the repo:
22
23```sh
24cargo xflowey restore-packages
25```
26
27If you intend to cross-compile, refer to the command's `--help` for additional
28options related to downloading packages for other architectures.
29
30### \[Linux] Additional Dependencies
31
32On Linux, there are various other dependencies you will need depending on what
33you're working on. On Debian-based distros such as Ubuntu, running the following
34command within WSL will install these dependencies.
35
36In 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
49OpenVMM uses the standard Rust build system, `cargo`.
50
51To build OpenVMM, simply run:
52
53```sh
54cargo build
55```
56
57Note that certain features may require compiling with additional `--feature`
58flags.
59
60## Troubleshooting
61
62This section documents some common errors you may encounter while building
63OpenVMM.
64
65If you are still running into issues, consider filing an issue on the OpenVMM
66GitHub Issue tracker.
67
68### failed to invoke protoc
69
70**Error:**
71
72```
73error: failed to run custom build command for `inspect_proto v0.0.0 (/home/daprilik/src/openvmm/support/inspect_proto)`
74
75Caused 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
81warning: build failed, waiting for other jobs to finish...
82```
83
84Note: the specific package that throws this error may vary, and may not always be `inspect_proto`
85
86**Solution:**
87
88You attempted to build OpenVMM without first restoring necessary packages.
89
90Please run `cargo xflowey restore-packages`, and try again.
91
92### use of unstable library feature
93
94**Error:**
95
96```
97error[E0658]: use of unstable library feature 'absolute_path'
98 --> flowey/flowey/src/lib.rs:37:17
99 |
10037 | std::path::absolute(self)
101 | ^^^^^^^^^^^^^^^^^^^
102 |
103 = note: see issue #92750 <https://github.com/rust-lang/rust/issues/92750> for more information
104
105For more information about this error, try `rustc --explain E0658`.
106error: could not compile `flowey` (lib) due to previous error
107```
108
109**Solution:**
110
111Install 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