Closed paolostivanin closed 1 year ago
Hey Paolo, thanks for the report!
I've had a quick look at this, and I think this is a bindgen-rs issue. The compilation error happens when the userfaultfd-sys
crate uses bindgen-rs
to generate rust bindings to linux/userfaultfd.h
. I found a similar issue on the bindgen.rs repository that is related to clang changing behavior wrt anonymous type naming (https://github.com/rust-lang/rust-bindgen/issues/2312). In this specific case here, some struct member ends up named uffd_msg_union_(unnamed_at_/usr/include/linux/userfaultfd_h_102_2)
, and then a derive macro implemented on that struct rightfully complains that that's not a valid identifier. This apparently got patched in bindgen 0.62.0, but userfaultfd-sys is still using 0.60.1.
Could you check if you run into the same error if you only try to compile the userfaultfd crate in the same setup? If so, then userfaultfd-rs
needs to update its dependency on bindgen-rs
to at least 0.62.0 (and if that also does not fix it, then this is probably a new bindgen bug).
As for an immediate fix, you could try downgrading clang to a version prior to 16, as that's when the change in clang got introduced.
As an aside, I noticed that on Leap you're compiling firecracker 1.2, but on tumbleweed its 1.3.1, is that intended?
Yes, I just started working on packaging 1.3.1 :) first I've gotta push it to TW, then I can forward it to Leap 15.5. Currently, on TW we have 1.2, but that also fails to compile on x86_64.
Could you check if you run into the same error if you only try to compile the userfaultfd crate in the same setup?
Not sure how to do that. I'm kinda new to Rust, so my Cargo knowledge is limited. If you could kindly provide me with a branch that contains this fix, I can simply download it and test whether the compilation works :smile:
As for an immediate fix, you could try downgrading clang to a version prior to 16, as that's when the change in clang got introduced.
Unfortunately, that it's not possible.
Could you check if you run into the same error if you only try to compile the userfaultfd crate in the same setup?
Not sure how to do that. I'm kinda new to Rust, so my Cargo knowledge is limited. If you could kindly provide me with a branch that contains this fix, I can simply download it and test whether the compilation works 😄
So to verify that the issue is indeed in userfaultfd-rs
, you can do
git clone https://github.com/bytecodealliance/userfaultfd-rs
cd userfaultfd-rs
cargo build
which should fail with the same error you were getting above.
There is no fixed branch yet that I'm aware of, but the patch for that crate should be
diff --git userfaultfd-sys/Cargo.toml userfaultfd-sys/Cargo.toml
index 840d295..b08dd39 100644
--- userfaultfd-sys/Cargo.toml
+++ userfaultfd-sys/Cargo.toml
@@ -13,7 +13,7 @@ build = "build.rs"
cfg-if = "^1.0.0"
[build-dependencies]
-bindgen = { version = "^0.60.1", default-features = false, features = ["runtime"] }
+bindgen = { version = "^0.64.0", default-features = false, features = ["runtime"] }
cc = "1.0"
[features]
You can try applying that to that repository and run cargo build
again. If that works, then the best you can do is submit an issue/PR to userfaultfd to get them to update their bindgen dependency.
Sorry for not checking all this myself btw, but I don't really know how to get my hands on clang 16 easily >.>
thank you, I'll try your solution :)
@paolostivanin does the solution provided above work for you?
Thanks!
the issue is fixed with the latest 1.3.2 update, thanks
While compiling firecracker for openSUSE Tumbleweed x86_64, the compilation fails with:
please note that:
Please find attached logs both for Leap 15.5 x86_64 compiling fine and Tumbleweed x86_64 not compiling due to the aforementioned error.
leapOK.txt tumbleweedFAIL.txt