-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmake] always target Windows SDK v10.x when using Visual Studio generators (fixes #6448) #6451
Conversation
@jameslamb Thanks for looking into this. Some questions:
|
Good question! My understanding is that v10 of the SDK supports Windows 11 and most versions of Windows Server. See "Supported Operating Systems" here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/. For example, the R-package MSVC tests here are targeting Windows Server 2019 and Windows 2022. https://github.com/actions/runner-images?tab=readme-ov-file#available-images LightGBM/.github/workflows/r_package.yml Lines 92 to 107 in 20f2092
Not 100% sure (Windows-specific development is not something I have a lot of experience in), but I think that winsock2, for example, comes through the Windows SDK. LightGBM/src/network/socket_wrapper.hpp Lines 22 to 24 in 20f2092
https://learn.microsoft.com/en-us/windows/win32/winsock/creating-a-basic-winsock-application If you see some other alternative to simplify LightGBM's Windows builds here I'd welcome it. |
It compiles correctly with msvc after this PR, but with some caveats: if compiling for a second time, it hangs indefinitely without issuing any message (just stuck in |
Oh interesting, I haven't seen that before. I'm not sure what the cause of that might be. You can skip building the vignettes (and therefore compiling the library twice) by passing Rscript build_r.R --no-build-vignettes We have vignette-building on by default so that the package tarball that's produced is suitable to pass to |
@guolinke or @shiyu1994 could you help with a review of this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #6448
Related to #5884.
Helps with #6213.
Proposes always targeting v10.x of the Windows SDK in CMake builds using the Visual Studio generators.
Notes for Reviewers
How I tested this
Building the R package, using Visual Studio 17 2022, on my Windows laptop running Windows 10 Home Edition.
With rtools44 (https://cran.r-project.org/bin/windows/Rtools/rtools44/rtools.html) on PATH.
Without this change,
CMake
targets via 8.1 of the Windows SDK and detects the wrong Windows version.That causes all of the Visual Studio and then the MSBuild solutions to fail, and therefore installation of the R package to fail.
With this change, it correctly targets v10 of the Windows SDK.
References