Windows: build.rs doesn't link advapi32, which the NGX static library needs (LNK2019 __imp_RegCloseKey)

未关闭 适合新手
#39 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
build-system

调研方向

阅读 build.rs 的 Windows 分支,检查它如何为 NGX 静态库发出链接器指令。在那里添加 advapi32 链接指令,然后使用 cargo test 运行 crate 的 Windows MSVC 测试二进制文件;当它们链接时不再出现未解析的 RegCloseKey 错误,即表示完成。

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

描述

On Windows, build.rs links NGX's static library (nvsdk_ngx_d.lib or nvsdk_ngx_s.lib). That library reads the registry: NGXGetPathFromRegistry calls RegOpenKey… and RegCloseKey, which come from advapi32. build.rs doesn't emit cargo:rustc-link-lib=advapi32, so a final binary that doesn't get advapi32 from some other dependency fails to link:

error LNK2019: unresolved external symbol __imp_RegCloseKey referenced in function NGXGetPathFromRegistry

We hit this in a crate's test binaries (cargo test of a library that depends on dlss_wgpu with no other advapi32 user). Larger binaries usually pick up advapi32 from std or another -sys crate, which hides the gap.

Environment: dlss_wgpu 6.0.0, DLSS SDK 310.9.1, x86_64-pc-windows-msvc, MSVC 2022 linker.

Suggested fix: in the Windows branch of build.rs:

println!("cargo:rustc-link-lib=advapi32");

Workaround: a downstream build.rs that emits the same line when targeting Windows.

主要语言
Rust
星标
60
派生
18
平均合并
1 天 4 小时
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

bevyengine/dlss_wgpu 的其他 Issue

查看 bevyengine/dlss_wgpu 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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