E1883: the Windows libraries for linking are missing

View source

A hosted Windows program is linked against the MSVC runtime libraries (libcmt.lib) and the Windows SDK libraries (kernel32.lib, libucrt.lib and their neighbours).

A hosted Windows program is linked against the MSVC runtime libraries (libcmt.lib) and the Windows SDK libraries (kernel32.lib, libucrt.lib and their neighbours). Actus links with its own bundled LLD but does not ship those libraries (ADR-0138). When LIB is not set, the compiler looks for them in the places a Visual Studio or Build Tools installation puts them; this error means it found a part missing. It is an error of the machine and of no file of the project, so it prints as error[E1883]: message, with no path, before any linker runs. The message names what is missing (the MSVC toolset, the Windows SDK, or both), every place that was searched for it, and what to install:

text
error[E1883]: cannot link for `x86_64-pc-windows-msvc`: LIB is not set and the MSVC toolset and the Windows SDK libraries were not found. Searched: MSVC toolset: VCToolsInstallDir is not set; vswhere.exe found no Visual Studio with the MSVC C++ tools (component Microsoft.VisualStudio.Component.VC.Tools.x86.x64) | Windows SDK: WindowsSdkDir and WindowsSDKLibVersion are not both set; registry KitsRoot10 is not set; default root `C:\Program Files (x86)\Windows Kits\10`: no Lib\<version> has um\x64\kernel32.lib and ucrt\x64\libucrt.lib. Install "Build Tools for Visual Studio" with the "Desktop development with C++" workload, which brings the MSVC toolset and a Windows SDK, or run actus from a Developer Command Prompt, which sets LIB

The same code reports a target whose architecture has no Windows library directory (for example riscv64) when LIB is not set.

Cause

actus build or actus run links a hosted *-windows-msvc program on a Windows host, LIB is not set (a plain Command Prompt or PowerShell does not set it), and one of these is not found:

  • the MSVC toolset: VCToolsInstallDir, then the latest Visual Studio that vswhere.exe reports with the MSVC x86/x64 tools, with a VC\Tools\MSVC\<version>\lib\<arch>\libcmt.lib;
  • the Windows SDK: WindowsSdkDir with WindowsSDKLibVersion, then the Windows Kits 10 root of the registry or %ProgramFiles(x86)%\Windows Kits\10, with a Lib\<version> that has um\<arch>\kernel32.lib and ucrt\<arch>\libucrt.lib.

A program cannot trigger this error on purpose, so it has no example.

Fix

Install "Build Tools for Visual Studio" and select the "Desktop development with C++" workload; it brings the MSVC toolset and a Windows SDK. Or run actus from a Developer Command Prompt for Visual Studio, which sets LIB. Setting ACTUS_LINKER or linker in Actus.toml selects another linker but does not remove the need for the libraries.


Run actus explain E1883 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.