microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.18k stars 6.16k forks source link

[zlib] Build error on x64-windows #39323

Open cheditx opened 2 weeks ago

cheditx commented 2 weeks ago

issue_body.md

WangWeiLin-MV commented 2 weeks ago

Using the latest version of vcpkg for local installation does not reproduce the issue.

Please make sure that the component Windows SDK is installed in the Visual Studio Installer, or re-install VS build tools.

AenBleidd commented 2 weeks ago

@cheditx, you need to have 'Desktop development with C++' workload installed: image

PfunnyGuy commented 2 weeks ago

I am having the same issue. I have installed every single Desktop C++ package from VS 22 installer.

Looking in the config-x64-windows-out.log file as instructed (and from what I've read in other posts) kernel32.lib is missing:

CMake Error at C:/Repos/vcpkg/downloads/tools/cmake-3.29.2-windows/cmake-3.29.2-windows-i386/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Repos/vcpkg/buildtrees/zlib/x64-windows-rel/CMakeFiles/CMakeScratch/TryCompile-yu459m'

    Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v cmTC_7a4a8
    [1/2] C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\cl.exe  /nologo   /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP   /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -MDd /showIncludes /FoCMakeFiles\cmTC_7a4a8.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_7a4a8.dir\ /FS -c C:\Repos\vcpkg\buildtrees\zlib\x64-windows-rel\CMakeFiles\CMakeScratch\TryCompile-yu459m\testCCompiler.c
    [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Repos\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_7a4a8.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_7a4a8.dir\testCCompiler.c.obj  /out:cmTC_7a4a8.exe /implib:cmTC_7a4a8.lib /pdb:cmTC_7a4a8.pdb /version:0.0 /machine:x64  /nologo    /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_7a4a8.exe 
    C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Repos\vcpkg\downloads\tools\cmake-3.29.2-windows\cmake-3.29.2-windows-i386\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_7a4a8.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_7a4a8.dir\testCCompiler.c.obj  /out:cmTC_7a4a8.exe /implib:cmTC_7a4a8.lib /pdb:cmTC_7a4a8.pdb /version:0.0 /machine:x64  /nologo    /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_7a4a8.dir/manifest.res CMakeFiles\cmTC_7a4a8.dir/manifest.rc" failed (exit code 0) with the following output:

    no such file or directory

    ninja: build stopped: subcommand failed.

I have updated the repo using Git. I've got the latest everything.

image

As I get this same behavior for every library I want to install with vcpkg, I'm sure it isn't zlib related. But I sure wish MS could make something that worked out of the box. I've spent 3 days trying to solve this problem.

dg0yt commented 2 weeks ago

--mt=CMAKE_MT-NOTFOUND

Not yet complete.

WangWeiLin-MV commented 1 week ago

Please build under Developer Command Prompt or Developer PowerShell which have specific environment variables set.

Or launch in command line, for example:

"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64

or

& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -Arch arm64 -HostArch amd64

After then, it could be checked by the command:

cl.exe /Bv

Which will show the compiler info.