VS2022 build error
-
I'm struggling to build with VS2022. I'd be thankful if someone could give me a tip on how to get rid of the error:
1> Rozpoczęto generowanie narzędzia CMake dla konfiguracji: „x64-Debug”. 1> Wiersz polecenia: "C:\windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\data\projects\strawberry\strawberry\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DARCH=x86_64 -DICU_ROOT=c:\\strawberry_msvc_x86_64_debug -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\data\projects\strawberry\strawberry" 2>&1" 1> Katalog roboczy: C:\data\projects\strawberry\strawberry\out\build\x64-Debug 1> [CMake] -- The C compiler identification is MSVC 19.35.32217.1 1> [CMake] -- The CXX compiler identification is MSVC 19.35.32217.1 1> [CMake] -- Detecting C compiler ABI info 1> [CMake] -- Detecting C compiler ABI info - failed 1> [CMake] -- Check for working C compiler: C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe 1> [CMake] -- Check for working C compiler: C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe - broken 1> [CMake] CMake Error at C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message): 1> [CMake] The C compiler 1> [CMake] 1> [CMake] "C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" 1> [CMake] 1> [CMake] is not able to compile a simple test program. 1> [CMake] 1> [CMake] It fails with the following output: 1> [CMake] 1> [CMake] Change Dir: C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-xpvc80 1> [CMake] 1> [CMake] Run Build Command(s):C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_a84f8 && [1/2] Building C object CMakeFiles\cmTC_a84f8.dir\testCCompiler.c.obj 1> [CMake] [2/2] Linking C executable cmTC_a84f8.exe 1> [CMake] FAILED: cmTC_a84f8.exe 1> [CMake] cmd.exe /C "cd . && "C:\Program Files\cad\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_a84f8.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_a84f8.dir\testCCompiler.c.obj /out:cmTC_a84f8.exe /implib:cmTC_a84f8.lib /pdb:cmTC_a84f8.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." 1> [CMake] RC Pass 1: command "rc /fo CMakeFiles\cmTC_a84f8.dir/manifest.res CMakeFiles\cmTC_a84f8.dir/manifest.rc" failed (exit code 0) with the following output: 1> [CMake] Nie można odnaleźć określonego pliku 1> [CMake] ninja: build stopped: subcommand failed. 1> [CMake] 1> [CMake] 1> [CMake] 1> [CMake] 1> [CMake] 1> [CMake] CMake will not be able to correctly generate this project. 1> [CMake] Call Stack (most recent call first): 1> [CMake] CMakeLists.txt:3 (project) 1> [CMake] -- Configuring incomplete, errors occurred! 1> [CMake] See also "C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeOutput.log". 1> [CMake] See also "C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeError.log". 1> Wykonanie operacji „C:\windows\system32\cmd.exe” „/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\data\projects\strawberry\strawberry\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DARCH=x86_64 -DICU_ROOT=c:\\strawberry_msvc_x86_64_debug -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\data\projects\strawberry\strawberry" 2>&1"” nie powiodło się z powodu błędu: „„C:\windows\system32\cmd.exe”: element „/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\data\projects\strawberry\strawberry\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x86/cl.exe" -DARCH=x86_64 -DICU_ROOT=c:\\strawberry_msvc_x86_64_debug -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\CAD\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\data\projects\strawberry\strawberry" 2>&1"” zwrócił kod zakończenia: 1”.
-
@przemhb said in VS2022 build error:
CMakeOutput.log
Check the log files, CMakeOutput.log and CMakeError.log
-
@jonas
Thank you for your reply. I spotted the following error:
The specified file could not be found.
I confirmed that the following exists:
C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeScratch/
directory, but not its subdirectoryTryCompile-6m1cjp
- maybe deleted after the build attempt(?)When I run the command:
C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe
with no arguments, just to see the ninja.exe is there, I get:
ninja: error: loading 'build.ninja': The specified file could not be found.
Full CMakeError.log below:
Detecting C compiler ABI info failed to compile with the following output: Change Dir: C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-6m1cjp Run Build Command(s):C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_27de3 && [1/2] Building C object CMakeFiles\cmTC_27de3.dir\CMakeCCompilerABI.c.obj [2/2] Linking C executable cmTC_27de3.exe FAILED: cmTC_27de3.exe cmd.exe /C "cd . && "C:\Program Files\cad\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_27de3.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_27de3.dir\CMakeCCompilerABI.c.obj /out:cmTC_27de3.exe /implib:cmTC_27de3.lib /pdb:cmTC_27de3.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." RC Pass 1: command "rc /fo CMakeFiles\cmTC_27de3.dir/manifest.res CMakeFiles\cmTC_27de3.dir/manifest.rc" failed (exit code 0) with the following output: The specified file could not be found ninja: build stopped: subcommand failed. Determining if the C compiler works failed with the following output: Change Dir: C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-xpvc80 Run Build Command(s):C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_a84f8 && [1/2] Building C object CMakeFiles\cmTC_a84f8.dir\testCCompiler.c.obj [2/2] Linking C executable cmTC_a84f8.exe FAILED: cmTC_a84f8.exe cmd.exe /C "cd . && "C:\Program Files\cad\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_a84f8.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_a84f8.dir\testCCompiler.c.obj /out:cmTC_a84f8.exe /implib:cmTC_a84f8.lib /pdb:cmTC_a84f8.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." RC Pass 1: command "rc /fo CMakeFiles\cmTC_a84f8.dir/manifest.res CMakeFiles\cmTC_a84f8.dir/manifest.rc" failed (exit code 0) with the following output: The specified file could not be found ninja: build stopped: subcommand failed.
-
@przemhb
Did you check that you have the rc command?C:\>where rc C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\rc.exe
Maybe you are missing something related to C compiler or linker.
In Tools / "Get Tools And Features" / Individual components.
Check that you have:- C++ CMake tools for Windows
- MSVC v143 - VS 2022 C++ x64/x86 build tools (latest)
- C++ ALT for latest v143 build tools (x86 & x64)
- C++ core features
-
@jonas I've confirmed I've got those.
Yet still I get the error (in VS):CMake Error at C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "C:/Program Files/cad/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x86/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Data/Projects/strawberry/strawberry/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-ixd2b9 Run Build Command(s):C:/Program Files/cad/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe -v cmTC_faeaf && [1/2] C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x86\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_faeaf.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_faeaf.dir\ /FS -c C:\Data\Projects\strawberry\strawberry\out\build\x64-Debug\CMakeFiles\CMakeScratch\TryCompile-ixd2b9\testCCompiler.c [2/2] cmd.exe /C "cd . && "C:\Program Files\cad\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_faeaf.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_faeaf.dir\testCCompiler.c.obj /out:cmTC_faeaf.exe /implib:cmTC_faeaf.lib /pdb:cmTC_faeaf.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." FAILED: cmTC_faeaf.exe cmd.exe /C "cd . && "C:\Program Files\cad\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_faeaf.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_faeaf.dir\testCCompiler.c.obj /out:cmTC_faeaf.exe /implib:cmTC_faeaf.lib /pdb:cmTC_faeaf.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." LINK Pass 1: command "C:\PROGRA~1\cad\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x86\link.exe /nologo CMakeFiles\cmTC_faeaf.dir\testCCompiler.c.obj /out:cmTC_faeaf.exe /implib:cmTC_faeaf.lib /pdb:cmTC_faeaf.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_faeaf.dir/intermediate.manifest CMakeFiles\cmTC_faeaf.dir/manifest.res" failed (exit code 1104) with the following output: LINK : fatal error LNK1104: nie można otworzyć pliku „kernel32.lib” 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)
I am trying to figure out what I am missing here.
-
@przemhb said in VS2022 build error:
kernel32.lib
This is not the same error as the first.
Maybe something wrong with the linker configuration in Visual Studio.
https://stackoverflow.com/questions/39514632/error-cannot-open-file-kernel32-lib