rust-gpu: Newer libc versions (0.2.113 or later) don't compile with Rust-GPU's rust-toolchain.

Expected Behaviour

Following the steps described in the docs should work without errors in the supported platforms.

Example & Steps To Reproduce

  1. Create a new blanket rust project with cargo new
  2. Copy the rust tool-chain file from git onto the root of the project
  3. Add [build-dependencies] spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu" } to the toml file.
  4. Create a 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

  • Rust: rust version rustc 1.62.0-nightly (1f7fb6413 2022-04-10)
  • OS: Ubuntu 22.04
  • GPU: Nvidia GTX 1070
  • SPIR-V: vulkan

Backtrace

error[E0658]: `const extern fn` definitions are unstable
    --> /home/makogan/.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  | |                 }
     | |_________________^
     |
    ::: /home/makogan/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/unix/linux_like/mod.rs:1499:1
     |
1499 | / f! {
1500 | |     pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1501 | |         if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
1502 | |             (*mhdr).msg_control as *mut cmsghdr
...    |
1545 | |     }
1546 | | }
     | |_- 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
    --> /home/makogan/.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  | |                 }
     | |_________________^
     |
    ::: /home/makogan/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.131/src/unix/linux_like/mod.rs:1548:1
     |
1548 | / safe_f! {
1549 | |     pub fn SIGRTMAX() -> ::c_int {
1550 | |         unsafe { __libc_current_sigrtmax() }
1551 | |     }
...    |
1615 | |     }
1616 | | }
     | |_- 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)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Okay, before anyone wastes their time, this is not limited to aarch64, these are coincidences (just like #889, it’s getting kind of ridiculous).

Try running cargo install cargo-apk inside the Rust-GPU directory (so that cargo install picks up our rust-toolchain) - this will try to build libc for your host and that’s broken in the combination of new libc and the older nightly (regardless of what your host arch actually is, as long as it’s Linux UNIX-y).