EmbarkStudios/rust-gpu

spirv_builder sometimes cannot find symbols

Makogan opened this issue · 0 comments

This is likely not a bug but user error, but I find it very confusing.

I made a wrapper crate around spirv_builder, whose only purpose is to compile shaders to spirv through the terminal.

This crates is under rustbuilder/ the crate compiles but I ran it in two different shader crates and one works the other doesn't. The specific commands I ran where:

Works

../vulkan_bindings/src/rustbuilder/target/debug/rustbuilder -i ../vulkan_bindings/test_data/spinning_triangle_shader/

Fails

../vulkan_bindings/src/rustbuilder/target/debug/rustbuilder -i ../../examples/01_spinning_triangle/spinning_triangle_shader/

Error:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/makogan/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -Zcodegen-backend=/home/makogan/rust_never_engine/crates/vulkan_bindings/src/rustbuilder/target/debug/librustc_codegen_spirv.so -Zbinary-dep-depinfo -Csymbol-mangling-version=v0 '-Zcrate-attr=feature(register_tool)' '-Zcrate-attr=register_tool(rust_gpu)' -Coverflow-checks=off -Cdebug-assertions=off -Zinline-mir=off '-Cllvm-args=--module-output=multiple --spirv-metadata=name-variables --scalar-block-layout --preserve-bindings target-feature=+RuntimeDescriptorArray,' '-Ctarget-feature=+SampledImageArrayDynamicIndexing,+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing' --target spirv-unknown-vulkan1.2 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "spirv-unknown-vulkan1.2". Run `rustc --print target-list` for a list of built-in targets

thread 'main' panicked at src/lib.rs:123:17:

stack backtrace:
   0: rust_begin_unwind
             at /rustc/75c68cfd2b9870f2953b62d250bd7d0564a7b56d/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/75c68cfd2b9870f2953b62d250bd7d0564a7b56d/library/core/src/panicking.rs:72:14
   2: rustbuilder::lib::compile_shader_crate
             at /home/makogan/rust_never_engine/crates/vulkan_bindings/src/rustbuilder/src/lib.rs:123:17
   3: rustbuilder::main
             at /home/makogan/rust_never_engine/crates/vulkan_bindings/src/rustbuilder/src/main.rs:20:19
   4: core::ops::function::FnOnce::call_once
             at /rustc/75c68cfd2b9870f2953b62d250bd7d0564a7b56d/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The Cargo.toml of both crates are identical, I have cleaned everything multiple times. I am really lost as to what could cause this.

Copying any failing shader under ../vulkan_bindings/test_data/ allows it to compile even if it fails otherwise, but I don;t understand why, since all compilation is being done relative to the same root.