fasterthanlime/mevi

Build failure: "uffd_msg_union_(unnamed_at_/usr/include/linux/userfaultfd_h_109_2)" is not a valid Ident

Closed this issue · 2 comments

First of all, I would like to thank you for the great videos you've been doing!
I wanted to build the project, but I've got the following error:

just install
cargo install --locked --path crates/mevi
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
  Installing mevi v0.1.0 (/home/marxin/Programming/mevi/crates/mevi)
    Updating crates.io index
warning: package `bumpalo v3.12.1` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
warning: package `hermit-abi v0.3.1` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
   Compiling userfaultfd-sys v0.4.2 (https://github.com/fasterthanlime/userfaultfd-rs?rev=e9160a896f7d8d80c8b0943480885598bd698d0#e9160a89)
   Compiling heapless v0.7.16
   Compiling serde_json v1.0.96
   Compiling tokio-tungstenite v0.18.0
   Compiling serde_urlencoded v0.7.1
   Compiling tower v0.4.13
   Compiling serde_path_to_error v0.1.11
   Compiling rangemap v1.3.0
   Compiling hyper v0.14.26
   Compiling postcard v1.0.4
error: failed to run custom build command for `userfaultfd-sys v0.4.2 (https://github.com/fasterthanlime/userfaultfd-rs?rev=e9160a896f7d8d80c8b0943480885598bd698d0#e9160a89)`

Caused by:
  process didn't exit successfully: `/home/marxin/Programming/mevi/target/release/build/userfaultfd-sys-dd81e8e5c79cc072/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /home/marxin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:811:9:
  "uffd_msg_union_(unnamed_at_/usr/include/linux/userfaultfd_h_109_2)" is not a valid Ident
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `mevi v0.1.0 (/home/marxin/Programming/mevi/crates/mevi)`, intermediate artifacts can be found at `/home/marxin/Programming/mevi/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
error: Recipe `install` failed on line 7 with exit code 101

All right, I've got a fix by updating to the latest userfaultfd-rs package (with the needed patch from bytecodealliance/userfaultfd-rs@e9160a8).

Should I create a pull request, or can you please accept the following changes by your own?

diff --git a/Cargo.toml b/Cargo.toml
index 9e20106..4f64f2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,9 +3,7 @@ members = ["crates/*"]
 
 [workspace.dependencies]
 # expose-raw branch
-userfaultfd = { git = "https://github.com/fasterthanlime/userfaultfd-rs", rev = "e9160a896f7d8d80c8b0943480885598bd698d0", features = [
-       "linux4_14",
-] }
+userfaultfd = { path = "/home/marxin/Programming/userfaultfd-rs", features=["linux4_14"] }
 postcard = { version = "1.0.0", features = ["alloc"] }
 
 [profile.release]
diff --git a/crates/mevi-common/Cargo.toml b/crates/mevi-common/Cargo.toml
index 388c893..27bc216 100644
--- a/crates/mevi-common/Cargo.toml
+++ b/crates/mevi-common/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
 
 [dependencies]
 humansize = "2.1.3"
-nix = { version = "0.26.2", optional = true }
+nix = { version = "0.27", optional = true, features = ["process", "feature", "mman", "ptrace", "signal"] }
 rangemap = { version = "1.3.0", features = ["serde1"] }
 serde = { version = "1.0.156", features = ["derive"] }
 tracing = "0.1.37"
diff --git a/crates/mevi/Cargo.toml b/crates/mevi/Cargo.toml
index f806f10..2dba145 100644
--- a/crates/mevi/Cargo.toml
+++ b/crates/mevi/Cargo.toml
@@ -12,7 +12,7 @@ humansize = "2.1.3"
 lazy_static = "1.4.0"
 libc = "0.2.139"
 mevi-common = { version = "0.1.0", path = "../mevi-common" }
-nix = "0.26.2"
+nix = "0.27"
 passfd = "0.1.6"
 postage = "0.5.0"
 procfs = "0.15.1"

Thanks, Amos!

Hi! I upgraded my userfaultfd-rs fork, and updated mevi to depend on it (cf 9b864e1)

Thanks for the detailed report :)