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

wayland-protocols 0.23 build.rs fails #1085

Closed
m4b opened this issue Sep 25, 2020 · 7 comments
Closed

wayland-protocols 0.23 build.rs fails #1085

m4b opened this issue Sep 25, 2020 · 7 comments
Labels
C-bug Category: This is a bug.

Comments

@m4b
Copy link

m4b commented Sep 25, 2020

Oh hi @bjorn3 just wanted to report that I messed around, built rustc cranelift as recommended, and much to my joyful surprise, I was able to compile the wgpu-rs shadow example (1 minute faster!):

regular
Finished dev [unoptimized + debuginfo] target(s) in 3m 04s
cranelift
Finished dev [unoptimized + debuginfo] target(s) in 2m 06s

Here's a screenshot of wgpu-rs shadow example running in debug mode built with cranelift!

Screenshot from 2020-09-24 21-36-40

I just want to congratulate you on the absolute achievement this is, and once again, you and everyone else should be incredibly proud of the work you've done to get this far!

One thing to note is that I had to patch master:

diff --git a/Cargo.toml b/Cargo.toml
index b1d7fbb..7eec0da 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,7 +54,7 @@ gfx-backend-vulkan = { version = "0.6", features = ["x11"] }
 cgmath = "0.17"
 log = "0.4"
 png = "0.16"
-winit = { version = "0.22.1", features = ["web-sys"] }
+winit = { git = "https://github.com/kchibisov/winit", branch = "wayland-rework", features = ["web-sys"] }
 rand = { version = "0.7.2", features = ["wasm-bindgen"] }
 bytemuck = { version = "1.4", features = ["derive"] }
 noise = "0.6"

because 0.23 wayland-client (used by crates.io winit) and wayland-protocols fails at the build.rs step (only for cranelift); I'm not sure what the issue is there, but it appears to be resolved in 0.27, so there is that.

It was also an excuse to open this issue and praise you and everyone else who made this possible, once again, absolutely incredible work - I'm really, really looking forward to early adopting using cranelift rustc for my debug builds in the near future :)

@bjorn3
Copy link
Member

bjorn3 commented Sep 25, 2020

Thanks for the issue! wayland-protocols has given trouble in the past, though this has been during the actual compilation of the crate, not build.rs. What is the error/panic?

@bjorn3 bjorn3 added the C-bug Category: This is a bug. label Sep 25, 2020
@m4b
Copy link
Author

m4b commented Sep 25, 2020

this is all i see:

error: failed to run custom build command for `wayland-client v0.23.6`

Caused by:
  process didn't exit successfully: `/home/m4b/git/wgpu-rs/target/debug/build/wayland-client-2a18d8d054c0b928/build-script-build` (signal: 6, SIGABRT: process abort signal)
  --- stdout
  cargo:rerun-if-changed=./wayland.xml

@m4b
Copy link
Author

m4b commented Sep 25, 2020

Not sure if exec-ing directly helps (maybe it needs args or certain exec path), but it reports this:

/home/m4b/git/wgpu-rs/target/debug/build/wayland-client-2a18d8d054c0b928/build-script-build
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', /home/m4b/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/wayland-client-0.23.6/build.rs:10:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

@m4b
Copy link
Author

m4b commented Sep 25, 2020

wayland protocols also fails:

error: failed to run custom build command for `wayland-protocols v0.23.6`

Caused by:
  process didn't exit successfully: `/home/m4b/git/wgpu-rs/target/debug/build/wayland-protocols-76c934f9eac26fac/build-script-build` (signal: 6, SIGABRT: process abort signal)
  --- stdout
  cargo:rerun-if-changed-env=CARGO_FEATURE_CLIENT
  cargo:rerun-if-changed-env=CARGO_FEATURE_SERVER
  cargo:rerun-if-changed-env=CARGO_FEATURE_UNSTABLE_PROTOCOLS
  cargo:rerun-if-changed=./protocols/stable/presentation-time/presentation-time.xml

/home/m4b/git/wgpu-rs/target/debug/build/wayland-protocols-76c934f9eac26fac/build-script-build 
cargo:rerun-if-changed-env=CARGO_FEATURE_CLIENT
cargo:rerun-if-changed-env=CARGO_FEATURE_SERVER
cargo:rerun-if-changed-env=CARGO_FEATURE_UNSTABLE_PROTOCOLS
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', /home/m4b/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/wayland-protocols-0.23.6/build.rs:88:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

@bjorn3
Copy link
Member

bjorn3 commented Sep 25, 2020

Thanks! I will investigate.

thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent'

That is probably the OUT_DIR env var not being set.

@bjorn3
Copy link
Member

bjorn3 commented Sep 25, 2020

https://github.com/alexcrichton/proc-macro2/blob/f514921bb4405fea72b6289c200152f797d8b127/src/wrapper.rs#L70

It uses proc-macro2 which tries to detect if it is running as proc-macro by calling a proc_macro function and checking for a panic. cg_clif doesn't support catching panics yet, so the process aborts. Newer wayland-scanner versions force the non proc-macro implementation of proc-macro2: https://github.com/Smithay/wayland-rs/blob/83037ea5026e73aa0220b72d7e056625cc8a69a0/wayland-scanner/src/c_code_gen.rs#L13 This was done to work with panic=abort. (Smithay/wayland-rs#314)

@m4b
Copy link
Author

m4b commented Sep 29, 2020

ok cool, nice discovery! (i am terrified at prospects of panics being caught in build.rs scripts, but i digress)

Not sure there's much you can do about it (other than adding panic unwind support, but i'm sure that's on someone's radar somewhere :))

Anyway, I think we can close this? Winit 0.23 coming out soon anyway, which is where I noticed this, and it will use the later wayland-scanner and wayland-protocols, which I've tested work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants