Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Couldn't load codegen backend, specified module could not be found

未关闭
#327 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
rust

调研方向

使用链接的 rust-cuda-basic 项目和 getting started guide 重现该失败,然后检查第 17 行附近的 build.rs 以及 Windows 上加载 rustc_codegen_nvvm DLL 的命令。检查为什么 DLL 路径存在时 LoadLibraryExW 仍报告缺少模块;完成的标准是确定缺少的依赖项或配置,并记录或修正 Windows 构建路径。

由索引模型根据 Issue 内容生成。

描述

Hi,

I'm trying to build the example described in the getting started guide on Windows but I got an error:

> cargo build
   Compiling rustc_codegen_nvvm v0.3.0 (https://github.com/rust-gpu/rust-cuda?rev=7fa76f3d717038a92c90bf4a482b0b8dd3259344#7fa76f3d)
   Compiling cuda_builder v0.3.0 (https://github.com/rust-gpu/rust-cuda?rev=7fa76f3d717038a92c90bf4a482b0b8dd3259344#7fa76f3d)
   Compiling rust-cuda-basic v0.1.0 (D:\workspace\rust-cuda-basic)
error: failed to run custom build command for `rust-cuda-basic v0.1.0 (D:\workspace\rust-cuda-basic)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `D:\workspace\rust-cuda-basic\target\debug\build\rust-cuda-basic-11d5ae9c94c06876\build-script-build` (exit code: 101)
  --- stdout
  cargo::rerun-if-changed=build.rs
  cargo::rerun-if-changed=kernels
  cargo:rerun-if-changed=D:\workspace\rust-cuda-basic\kernels

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

  Caused by:
    process didn't exit successfully: `C:\Users\Carrot\.rustup\toolchains\nightly-2025-08-04-x86_64-pc-windows-msvc\bin\rustc.exe - --crate-name ___ --print=file-names -Zcodegen-backend=D:\workspace\rust-cuda-basic\target\debug\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_75 --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 \\?\D:\workspace\rust-cuda-basic\target\debug\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)


  thread 'main' panicked at build.rs:17:10:
  called `Result::unwrap()` on an `Err` value: BuildFailed
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/f34ba774c78ea32b7c40598b8ad23e75cdac42a6/library\std\src\panicking.rs:697
     1: core::panicking::panic_fmt
               at /rustc/f34ba774c78ea32b7c40598b8ad23e75cdac42a6/library\core\src\panicking.rs:75
     2: core::result::unwrap_failed
               at /rustc/f34ba774c78ea32b7c40598b8ad23e75cdac42a6/library\core\src\result.rs:1852
     3: build_script_build::main
     4: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

But the codegen backend path does exist:

> ls D:\workspace\rust-cuda-basic\target\debug\rustc_codegen_nvvm.dll

    Directory: D:\workspace\rust-cuda-basic\target\debug

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          30/11/2025  9:39 am       31755776 rustc_codegen_nvvm.dll

Any idea on what the actual problem is?

I'm using the prebuilt LLVM and CUDA 13.

Repro can be found here.

主要语言
Rust
星标
5.4k
派生
249
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Rust-GPU/rust-cuda 的其他 Issue

查看 Rust-GPU/rust-cuda 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。