Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firecracker compilation issue on openSUSE Tumbleweed x86_64 #3584

Closed
paolostivanin opened this issue Mar 31, 2023 · 7 comments
Closed

firecracker compilation issue on openSUSE Tumbleweed x86_64 #3584

paolostivanin opened this issue Mar 31, 2023 · 7 comments

Comments

@paolostivanin
Copy link

While compiling firecracker for openSUSE Tumbleweed x86_64, the compilation fails with:

[   91s]    Compiling bincode v1.3.3
[   92s] error: failed to run custom build command for `userfaultfd-sys v0.4.3`
[   92s] 
[   92s] Caused by:
[   92s]   process didn't exit successfully: `/home/abuild/rust/firecracker/release/build/userfaultfd-sys-f8761062372fd5c8/build-script-build` (exit status: 101)
[   92s]   --- stderr
[   92s]   thread 'main' panicked at '"uffd_msg_union_(unnamed_at_/usr/include/linux/userfaultfd_h_102_2)" is not a valid Ident', /home/abuild/rpmbuild/BUILD/firecracker-1.3.1/vendor/proc-macro2/src/fallback.rs:811:9
[   92s]   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[   92s] warning: build failed, waiting for other jobs to finish...
[  110s] warning: No default seccomp policy for target: x86_64-unknown-linux-gnu. Defaulting to `resources/seccomp/unimplemented.json`.
[  110s] error: Bad exit status from /var/tmp/rpm-tmp.ULCvUw (%build)
[  110s] 
[  110s] RPM build errors:
[  110s]     Bad exit status from /var/tmp/rpm-tmp.ULCvUw (%build)
[  110s] 
[  110s] suse-ws.fritz.box failed "build firecracker.spec" at Fri Mar 31 08:01:27 UTC 2023.

please note that:

  • it compiles OK on aarch64
  • it compiles OK on Leap 15.5 x86_64

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

@paolostivanin paolostivanin changed the title firecracker compilation issue firecracker compilation issue on openSUSE Tumbleweed x86_64 Mar 31, 2023
@roypat
Copy link
Contributor

roypat commented Mar 31, 2023

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 (rust-lang/rust-bindgen#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?

@paolostivanin
Copy link
Author

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.

@paolostivanin
Copy link
Author

paolostivanin commented Mar 31, 2023

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 😄

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.

@roypat
Copy link
Contributor

roypat commented Mar 31, 2023

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 >.>

@paolostivanin
Copy link
Author

thank you, I'll try your solution :)

@dianpopa
Copy link
Contributor

@paolostivanin does the solution provided above work for you?

Thanks!

@paolostivanin
Copy link
Author

the issue is fixed with the latest 1.3.2 update, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants