error MSB8040: Spectre-mitigated libraries are required for this project

Anonymous-User picture Anonymous-User · Dec 25, 2019 · Viewed 12.7k times · Source

I have a problem that I cannot solve. My code:

#include "ntddk.h"
#include <stdlib.h>

NTSTATUS DriverEntry(IN PDRIVER_OBJECT theDriverObject,
    IN PUNICODE_STRING theRegistryPath)
{
    DbgPrint("Hello World!");
    return STATUS_SUCCESS;
}

My goal is to run this program without any problems. Error message:

  • error MSB8040: Spectre-mitigated libraries are required for this project. Install them from the Visual Studio installer (Individual components tab) for any toolsets and architectures being used. Learn more: https://aka.ms/Ofhn4c

    I added some libraries but the error still apears. Added toolsets:

  • C++ ATL for the latest build tools version 142 (ARM)

  • C++ ATL for the latest build tools version 142 (ARM64)
  • C++ ATL for the latest build tools version (x86 i x64)
  • C++ ATL for the latest build tools version 142 with countermeasures for the Specter vulnerability (ARM)
  • C++ ATL for the latest build tools version 142 with countermeasures for the Specter vulnerability (ARM64)
  • C++ for the latest build tools version 142 with countermeasures for the Specter vulnerability (x86 i x64)

Could someone guide me step by step how to solve it?

Answer

Jesper Juhl picture Jesper Juhl · Dec 25, 2019

This: https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc and the /Qspectre compiler option, is probably, what you are looking for? (Note that you'd need to recompile all code, including libraries you use, with /Qspectre to take full advantage).