-
Notifications
You must be signed in to change notification settings - Fork 244
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
Newer libc versions (0.2.113 or later) don't compile with Rust-GPU's rust-toolchain. #907
Comments
Had the same issue. Looks like some of the deep dependencies are assuming newer nightly Rust versions. Quick fix: |
Here is another quick fix, that does not require to replace the whole Cargo.lock file: [dependencies]
spirv-builder = { git="https://github.com/EmbarkStudios/rust-gpu" }
libc = "=0.2.112" # Add this to your Cargo.toml. This version number is extracted from rust-gpu's Cargo.lock I think this issue boils down to spirv-builder not specifying libc version that is compatible with toolchain specified in rust-gpu's rust-toolchain file. The examples from rust-gpu are working because the Cargo.lock file specifies version of libc that is used in rust-gpu's codebase and this specific version of libc IS compatible with toolchain mentioned above. The general fix would be to introduce specific libc version in spirv-builder's Cargo.toml file. |
I've just followed the exact steps from the docs and I can't really repro your issue. I've also tried a lot of the older Do you know which Also a sidenote: I've published all public-facing rust-gpu crates and their dependencies to crates.io last week. So instead of referencing from the github, you can now fetch them from crates.io directly. Latest version is I've put my test setup on github: https://github.com/oisyn/rust-gpu-empty (which references the published crates, but if you go back one commit you'll get the github references) |
The non-working libc version for me is
The example that you have provided does not compile on my setup: Compiling libc v0.2.131
Compiling ahash v0.7.6
Compiling sanitize-filename v0.4.0
Compiling quote v1.0.21
Compiling num-traits v0.2.15
Compiling indexmap v1.9.1
error[E0658]: `const extern fn` definitions are unstable
--> /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/macros.rs:203:17
|
203 | / pub $($constness)* extern fn $i($($arg: $argty),*
204 | | ) -> $ret {
205 | | $($body);*
206 | | }
| |_________________^
|
::: /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/unix/bsd/mod.rs:572:1
|
572 | / safe_f! {
573 | | pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
574 | | status & 0o177
575 | | }
... |
591 | | }
592 | | }
| |_- in this macro invocation
|
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
= note: this error originates in the macro `safe_f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: `const extern fn` definitions are unstable
--> /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/macros.rs:188:17
|
188 | / pub $($constness)* unsafe extern fn $i($($arg: $argty),*
189 | | ) -> $ret {
190 | | $($body);*
191 | | }
| |_________________^
|
::: /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/unix/bsd/apple/mod.rs:4758:1
|
4758 | / f! {
4759 | | pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
4760 | | cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {
4761 | | if cmsg.is_null() {
... |
4793 | | }
4794 | | }
| |_- in this macro invocation
|
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: `const extern fn` definitions are unstable
--> /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/macros.rs:203:17
|
203 | / pub $($constness)* extern fn $i($($arg: $argty),*
204 | | ) -> $ret {
205 | | $($body);*
206 | | }
| |_________________^
|
::: /Users/wiktorjurkiewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/unix/bsd/apple/mod.rs:4796:1
|
4796 | / safe_f! {
4797 | | pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
4798 | | status >> 8
4799 | | }
... |
4815 | | }
4816 | | }
| |_- in this macro invocation
|
= note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
= help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
= note: this error originates in the macro `safe_f` (in Nightly builds, run with -Z macro-backtrace for more info)
Compiling syn v1.0.99
For more information about this error, try `rustc --explain E0658`.
error: could not compile `libc` due to 3 previous errors
warning: build failed, waiting for other jobs to finish... |
Ah |
Okay, but I can't see how this should help us to resolve the general issue |
It doesn't, I was just thinking out loud ;) |
More specifically, it looks like it's the thing I mentioned in #890 (comment) (see rust-lang/libc@576f778#r80215910).
Wait, I know why @glandium said "early 1.62.0 nightlies" (emphasis mine), this stabilized it: So based on this, we only need to rustup to |
So it seems like this issue is present, as far as I known, only on aarm toolchain |
As I already started working on getting the nightly up to date, the expectation is that this issue gets fixed automatically as soon as we're up to date far enough, which given @eddyb's comment doesn't seem too far in the future relative to 2022-04-11 so this will probably be very soon. So I'm inclined to leave this issue as-is for now. You have a workaround by pinning |
That works for me, thanks for clarification! |
Okay, before anyone wastes their time, this is not limited to Try running |
I think this is not limited to Linux only, I'm using MacOS (Darwin) and this issue is present. |
Ah, my bad, I reacted to |
From curiosity I've started reading libc's readme, you could see that const-extern-fn is a feature so it should be possible to disable it, am I right? |
@watjurk I don't think so, I remember it being force-enabled by its |
I was able to repro the issue locally under linux, and can confirm it goes away when building with |
Expected Behaviour
Following the steps described in the docs should work without errors in the supported platforms.
Example & Steps To Reproduce
[build-dependencies] spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu" }
to the toml file.build.rs
file, copy the snippet from the docs and replace the path to the shader and the target with the relevant strings.System Info
Backtrace
The text was updated successfully, but these errors were encountered: