Muratori documents the absurd workaround required to make clang++ on Windows find Microsoft's link.exe linker. Rather than providing a simple command-line switch to specify the linker path, clang has ~1500 lines of code dedicated to 'finding' the linker by detecting Visual Studio installations. The only reliable solution is to reverse-engineer that detection code and construct a fake Visual Studio install directory structure. Muratori provides the minimal steps: create a fake bin/HostX64/x64 directory, copy link.exe into it, set VCToolsInstallDir, and add the real linker path to PATH for DLL resolution. He wraps everything in a batch file with setlocal to avoid environment contamination.
Jan 23, 2019 Tools & DebuggingSoftware Engineering