Skip to content

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

Open
@stevefan1999-personal

Description

@stevefan1999-personal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions