Skip to content

Resolve Windows SDK ucrt path dynamically in build.rs - #13

Merged
calladoum-elastic merged 7 commits into
mainfrom
copilot/add-dynamic-msvc-path
Sep 21, 2026
Merged

calladoum-elastic merged 7 commits into
mainfrom
copilot/add-dynamic-msvc-path

Conversation

Copilot AI commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The Windows debug build was pinned to a single Windows SDK version via a hardcoded MSVC_PATH, which breaks when only newer SDKs are installed. This updates build.rs to resolve the ucrt library path dynamically instead of assuming 10.0.22000.0.

  • Windows SDK path resolution

    • replace the fixed SDK path with runtime resolution in build.rs
    • prefer an explicit MSVC_PATH override when provided
    • otherwise use standard Windows SDK environment variables if present
    • fall back to scanning Windows Kits\\10\\Lib and selecting the newest SDK that contains ucrt/x64
  • Build-script invalidation

    • add rerun-if-env-changed entries for the Windows SDK-related environment variables so Cargo rebuilds when the configured SDK path changes
  • Focused build-script coverage

    • add small unit tests for SDK version normalization and latest-SDK selection logic
if let Some(path) = env::var_os("MSVC_PATH") {
    let path = PathBuf::from(path);
    if has_windows_ucrt_libs(&path) {
        return Some(path);
    }
}

find_latest_windows_sdk_dir(Path::new(WINDOWS_KITS_LIB_DIR))

Co-authored-by: calladoum-elastic <85187342+calladoum-elastic@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dynamic MSVC_PATH for ucrt Resolve Windows SDK ucrt path dynamically in build.rs Sep 18, 2026
@calladoum-elastic
calladoum-elastic marked this pull request as ready for review September 18, 2026 19:05

@1337-42 1337-42 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calladoum-elastic
calladoum-elastic merged commit 249b475 into main Sep 21, 2026
4 checks passed
@calladoum-elastic
calladoum-elastic deleted the copilot/add-dynamic-msvc-path branch September 21, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dynamic MSVC_PATH for ucrt

3 participants