Rust-GPU / Rust-GPU/rust-gpu

glam dependency is not optional in spirv-std

Open
#146 14 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

The readme in spirv-std states:

Optionally, through the use of the "glam" feature, it includes some boilerplate trait implementations to make glam vector types compatible with these APIs.

However, there is no feature flag that actually controls the glam bindings. As such, on a clean dependency with no features specified, spirv-std requires glam as a dependency to build. Also, the workspace level default-features=false does not seem to get used properly, making std included with glam.

I would definitely like to see this optional, and then perhaps introduce an nalgebra helper as well in the future.

--- stderr
      Blocking waiting for file lock on build directory
     Compiling core v0.0.0 (/home/marios/.rustup/toolchains/nightly-2024-04-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
     Compiling compiler_builtins v0.1.109
     Compiling serde_json v1.0.132
     Compiling smallvec v1.13.2
     Compiling spirv-tools-sys v0.8.0
     Compiling libm v0.2.11
     Compiling num-traits v0.2.19
     Compiling typenum v1.17.0
     Compiling spirv-tools v0.10.0
     Compiling spirt v0.4.0
     Compiling rustc_codegen_spirv-types v0.9.0 (https://github.com/Rust-GPU/rust-gpu.git#0da80f8a)
     Compiling rustc_codegen_spirv v0.9.0 (https://github.com/Rust-GPU/rust-gpu.git#0da80f8a)
     Compiling rustc-std-workspace-core v1.99.0 (/home/marios/.rustup/toolchains/nightly-2024-04-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
     Compiling bytemuck v1.19.0
     Compiling spirv-std-types v0.9.0 (https://github.com/Rust-GPU/rust-gpu.git#0da80f8a)
     Compiling bitflags v1.3.2
     Compiling glam v0.24.2
  error[E0463]: can't find crate for `std`
    --> /home/marios/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-traits-0.2.19/src/lib.rs:23:1
     |
  23 | extern crate std;
     | ^^^^^^^^^^^^^^^^^ can't find crate
     |
     = note: the `spirv-unknown-vulkan1.2` target may not support the standard library
     = help: consider building the standard library from source with `cargo build -Zbuild-std`

  error[E0463]: can't find crate for `std`
    |
    = note: the `spirv-unknown-vulkan1.2` target may not support the standard library
    = note: `std` is required by `glam` because it does not declare `#![no_std]`
    = help: consider building the standard library from source with `cargo build -Zbuild-std`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the spirv-std README and its Cargo dependency and feature metadata. Reproduce a clean build with no features for the spirv target, then verify that glam is not required and std is not pulled in; the dependency configuration and no-feature build should reflect the documented optional behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.