Just running a “Hello, World!” C++ program to be build with CMake and clang on the windows executor results in the following error I cannot reproduce on my local Windows 10 machine. Note the bold text from the linker.
lld-link: error: could not open ‘oldnames.lib’: no such file or directory
lld-link: error: could not open ‘msvcrtd.lib’: no such file or directory
C:\Users\circleci\project>cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE:STRING=~/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -G Ninja "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin\clang.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin\clang.exe" -B build -S .
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 12.0.0 with GNU-like command-line
-- The CXX compiler identification is Clang 12.0.0 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/bin/clang.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/circleci/project/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/ProgramData/Chocolatey/bin/ninja.exe cmTC_508c7 && [1/2] Building C object CMakeFiles/cmTC_508c7.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_508c7.exe
FAILED: cmTC_508c7.exe
cmd.exe /C "cd . && C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\Llvm\x64\bin\clang.exe -fuse-ld=lld-link -nostartfiles -nostdlib -g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console CMakeFiles/cmTC_508c7.dir/testCCompiler.c.obj -o cmTC_508c7.exe -Xlinker /implib:cmTC_508c7.lib -Xlinker /pdb:cmTC_508c7.pdb -Xlinker /version:0.0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cmd.exe /C "cd /D C:\Users\circleci\project\build\CMakeFiles\CMakeTmp && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Users/circleci/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/circleci/project/build/CMakeFiles/CMakeTmp/cmTC_508c7.exe -installedDir C:/Users/circleci/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
lld-link: error: could not open 'oldnames.lib': no such file or directory
lld-link: error: could not open 'msvcrtd.lib': no such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
Is the installation for VS community edition complete in Circle CI? Google searches seem to point that the VS installation is missing things if this error occurs. Is there anything that I could manually install in another build step to alleviate this?