Skip to content

glam dependency is not optional in spirv-std #146

@marstaik

Description

@marstaik

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions