Rust-GPU / Rust-GPU/rust-cuda

Windows: rustc_codegen_nvvm fails to load due to missing nvvm64_40_0.dll in PATH

Open
#220 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
5.4k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

I noticed rustc_codegen_nvvm is yapping on Windows:

error: failed to run custom build command for `vecadd v0.1.0 (F:\Git\github.com\rust-gpu\Rust-CUDA\examples\cuda\vecadd)`

Caused by:
  process didn't exit successfully: `F:\Git\github.com\rust-gpu\Rust-CUDA\target\debug\build\vecadd-06fc7e2d750a3fd2\build-script-build` (exit code: 101)
  --- stdout
  cargo::rerun-if-changed=build.rs
  cargo::rerun-if-changed=kernels
  cargo:rerun-if-changed=F:\Git\github.com\rust-gpu\Rust-CUDA\examples\cuda\vecadd\kernels

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

  Caused by:
    process didn't exit successfully: `sccache C:\Users\steve\scoop\persist\rustup\.rustup\toolchains\nightly-2025-03-02-x86_64-pc-windows-msvc\bin\rustc.exe - --crate-name ___ --print=file-names -Zcodegen-backend=F:\Git\github.com\rust-gpu\Rust-CUDA\target\debug\deps\rustc_codegen_nvvm.dll -Zcrate-attr=feature(register_tool) -Zcrate-attr=register_tool(nvvm_internal) -Zcrate-attr=no_std -Zsaturating_float_casts=false "-Cllvm-args=-arch=compute_61 --override-libm" --target nvptx64-nvidia-cuda --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 -Wwarnings` (exit code: 1)
    --- stderr
    error: couldn't load codegen backend \\?\F:\Git\github.com\rust-gpu\Rust-CUDA\target\debug\deps\rustc_codegen_nvvm.dll: LoadLibraryExW failed: The specified module could not be found. (os error 126) (The specified module could not be found. (os error 126)) (retried 5 times)

Then I noticed nvvm64_40_0.dll maybe missing:
Image

Indeed, adding nvvm folder to the PATH env fixed it:

$env:PATH += ";C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.9\nvvm\bin"
PS> cargo build
// just works

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

Reproduce the failure with cargo build from examples/cuda/vecadd and inspect its build.rs invocation of rustc_codegen_nvvm. Check how the Windows process locates nvvm64_40_0.dll and whether the nvvm/bin PATH workaround is expected. Done means the Windows build loads the backend reliably without an undocumented manual environment change.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.