visual-studio-2019wdk

VS2019+WDK10, missing Spectre-mitigated MSVC library for 16.11, why?


Some weird stuff here. I'm trying to build a KMDF sample driver with VS2019 16.11.5 and WDK 10.0.19041.685 (also called version 2004 Dec 2020 update).

First, I got compilation error saying that I need to download Spectre-mitigated MSVC library.

enter image description here

Well, I try it, but got a new problem. The VS2019(16.11.5) installer does not show MSVC Spectre-mitigated MSVC library version for exact 16.11. Looks like the latest one it provides is 16.10 (๐Ÿ™).

VS2019 installer, missing -16.11 Spectre-version

Download the 16.10 one and resume trying, still compilation error.

I peek into my D:\VSIDE\VS2019\VC\Tools\MSVC folder, and see two versions of MSVC libs listed, 14.29.30133 and 14.29.30037 . The later is the one with spectre libs(so it's 600MB+ larger).

two MSVC lib folders

14.29.30037 with spectre libs

However, the KMDF build tool insists to find MSVC libs in the newer 14.29.30133 folder, so Spectre-mitigated libs still CANNOT be found.

I know I can manually copy the required files from 14.29.30037 to 14.29.30133 to make things go on. BUT is it the decent way to do so, or is it a Microsoft toolset bug?

I'd like to ask how other kernel driver developers solve this issue. Thank you.


Solution

  • Well, several days later, I find out two workarounds for this issue.

    First, as Hans Passant stated, disable the Spectre lib in .vcxproj. This can be configured from UI.

    UI disable Spectre lib

    Second, explicitly select a MSVC library version for current project. This can also be configured in project settings UI.

    UI select MSVC Toolset version

    ==== 2022.02.11 UPDATE ====

    Finally got it๏ผŒthe Spectre-lib with version number 14.29.30133 is called "(Latest)", so it is listed above the oldest version, and this defeats the novice. Use this and problem solved.

    Spectre lib v14.29-16.11 here

    Sure, it is stupid enough to mark it as merely "(Lastest)". He should have named it MSVC v142 - VS2019 C++ x64/x86 Spectre-mitigated libs (v14.29-16.11)(Latest)" .