最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rust - Can't find DLL on windows despite PATH being set correctly - Stack Overflow

programmeradmin3浏览0评论

Context

For additional context so that people don't downvote for the sake of downvoting.

I rely on rustgpu, rustgpu has certain issues that force me to compile it as a standalone binary, separate from the rest of the code base, then invoke that binary at runtime in build scripts and such.

This setup works on linux. The reason why I am running into issues is that I cannot rely on the standard compilation process for most crates, I have to invoke rustgpu manually, the only way I have to communicate to rustgpu things such as where to find certain binaries is through env vars. Hence why this is messy.

Problem

I have a weird setup due to rustgpu. I am trying to get code that works on linux to work on windows as well.

The crux of the problem is this snippet:

 let cached_state = setup_hacked_compiler_toolchain_env_vars();
use std::fs;
        fs::write("./debug.txt", format!("{}\n", std::env::var(get_path_env_var()).unwrap())).expect("Unable to write file");

 std::env::var(get_path_env_var()).unwrap())).expect("Unable to write file");
        let result = SpirvBuilder::new(path, "spirv-unknown-vulkan1.2")
            .print_metadata(MetadataPrintout::None)
            .preserve_bindings(true)
            .spirv_metadata(SpirvMetadata::NameVariables)
            .scalar_block_layout(true)
            .multimodule(true)
            .capability(Capability::SampledImageArrayDynamicIndexing)
            .capability(Capability::RuntimeDescriptorArray)
            .extension("SPV_EXT_descriptor_indexing")
            .extra_arg("target-feature=+RuntimeDescriptorArray,")
            .build();

This calls rustgpu under the hood and sets up env vars.

I am getting this error from that call:

cargo build
   Compiling dem_gui v0.1.0 (C:\Users\Makogan\demiurge\crates\dem_gui)
error: failed to run custom build command for `dem_gui v0.1.0 (C:\Users\Makogan\demiurge\crates\dem_gui)`

Caused by:
  process didn't exit successfully: `C:\Users\Makogan\demiurge\crates\dem_gui\target\debug\build\dem_gui-cade5e935d0e054b\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-env=DEM_GUI_CONFIG_PATH=C:\Users\Makogan\demiurge\crates\dem_gui\debug_gui_shader\src\lib.rs

  --- stderr
  thread 'main' panicked at C:\Users\Makogan\demiurge\crates\vulkan_bindings\src\shader_parsing\rust_gpu_parsing.rs:58:9:
  current dir:C:\Users\Makogan\demiurge\crates\dem_gui
  command error:
  thread 'main' panicked at C:\Users\Makogan\.cargo\git\checkouts\rust-gpu-11142fd2aadc2318\de03795\crates\spirv-builder\src\lib.rs:527:5:
  Could not find rustc_codegen_spirv.dll in library path
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

   rustbuilder path: ..\vulkan_bindings\src\rustbuilder\target\release\rustbuilder
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If I inspect the context of my print file debug.txt I see:

/c/Users/Makogan/.rustup/nightly-2023-09-30-x86_64-pc-windows-msvc/lib:/c/Users/Makogan/demiurge/crates/vulkan_bindings/src/rustbuilder/target/release

If I print the output of get_path_env_var() I get PATH, which to my understanding is the correct env var to set when looking for DLLs.

So I don;t understand why the binary is not found? I know for a fact it is on the specified path.

发布评论

评论列表(0)

  1. 暂无评论