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

Open Beginner friendly
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
build-system

Research direction

Read the Windows branch of build.rs and check how it emits linker directives for the NGX static library. Add the advapi32 link directive there, then run the crate's Windows MSVC test binaries with cargo test; done means they link without the unresolved RegCloseKey error.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Rust
Stars
60
Forks
18
Avg merge
1d 4h
Merged PRs (30d)
1

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No 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.

More from bevyengine/dlss_wgpu

All issues in bevyengine/dlss_wgpu

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.