microsoft / vcpkg

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

[spdlog] Build error on x86-windows #40214

Open cdjzzzz opened 1 month ago

cdjzzzz commented 1 month ago

Package: spdlog:x86-windows@1.14.1

Host Environment

To Reproduce

vcpkg install spdlog:x86-windows

Failure logs

-- Using cached gabime-spdlog-v1.14.1.tar.gz.
-- Cleaning sources at C:/vcpkg/buildtrees/spdlog/src/v1.14.1-0ddeaa008e.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/vcpkg/downloads/gabime-spdlog-v1.14.1.tar.gz
-- Using source at C:/vcpkg/buildtrees/spdlog/src/v1.14.1-0ddeaa008e.clean
-- Found external ninja('1.11.0').
-- Configuring x86-windows
-- Building x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: C:/msys64/ucrt64/bin/cmake.exe --build . --config Debug --target install -- -v -j13
    Working Directory: C:/vcpkg/buildtrees/spdlog/x86-windows-dbg
    See logs for more information:
      C:\vcpkg\buildtrees\spdlog\install-x86-windows-dbg-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/spdlog/portfile.cmake:36 (vcpkg_cmake_install)
  scripts/ports.cmake:192 (include)
C:\vcpkg\buildtrees\spdlog\install-x86-windows-dbg-out.log ``` Change Dir: 'C:/vcpkg/buildtrees/spdlog/x86-windows-dbg' Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v -v -j13 install [1/9] RC C:\vcpkg\buildtrees\spdlog\x86-windows-dbg\version.rc CMakeFiles\spdlog.dir\version.rc.res.d CMakeFiles\spdlog.dir\version.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -I C:\vcpkg\installed\x86-windows\include -c65001 /DWIN32 -D_DEBUG /fo CMakeFiles\spdlog.dir\version.rc.res C:\vcpkg\buildtrees\spdlog\x86-windows-dbg\version.rc FAILED: CMakeFiles/spdlog.dir/version.rc.res RC C:\vcpkg\buildtrees\spdlog\x86-windows-dbg\version.rc CMakeFiles\spdlog.dir\version.rc.res.d CMakeFiles\spdlog.dir\version.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -I C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -I C:\vcpkg\installed\x86-windows\include -c65001 /DWIN32 -D_DEBUG /fo CMakeFiles\spdlog.dir\version.rc.res C:\vcpkg\buildtrees\spdlog\x86-windows-dbg\version.rc Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved. fatal error RC1107: invalid usage; use RC /? for Help [2/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\file_sinks.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\file_sinks.cpp [3/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\cfg.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\cfg.cpp [4/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\async.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\async.cpp [5/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\color_sinks.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\color_sinks.cpp [6/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\stdout_sinks.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\stdout_sinks.cpp [7/9] C:\PROGRA~1\MICROS~2\2022\PROFES~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x86\cl.exe /TP -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -Dspdlog_EXPORTS -IC:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\include -external:IC:\vcpkg\installed\x86-windows\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /Zc:__cplusplus /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /wd4251 /wd4275 /showIncludes /FoCMakeFiles\spdlog.dir\src\spdlog.cpp.obj /FdCMakeFiles\spdlog.dir\ /FS -c C:\vcpkg\buildtrees\spdlog\src\v1.14.1-0ddeaa008e.clean\src\spdlog.cpp ninja: build stopped: subcommand failed. ```
cdjzzzz commented 1 month ago

i remove C:/msys64/ucrt64/ from PATH temply, spdlog build success. But i have to add C:/msys64/ucrt64/ back to PATH, i have other project using C:/msys64/ucrt64/ cmake to compile with. How could i perfectly solve this issue to use two cmake tools?

greenozon commented 1 month ago

AFAIK you can't have 2 cmakes at the same time ... I mean you could but if you have external cmake (eg as in your case from msys install) - vcpkg will use it instead of internal one

PS vcpkg install spdlog:x86-windows builds just fine using cmake from vcpkg (cmake-3.29.2-windows)

greenozon commented 1 month ago

Oh, looks like you have an elegant way:

It is possible to instruct vcpkg to use its internal CMake instead of an external one. You can achieve this by setting the VCPKG_FORCE_SYSTEM_BINARIES environment variable to 0. This tells vcpkg to use its internal tools, including CMake, rather than any external versions.

Here's how you can set this environment variable:

set VCPKG_FORCE_SYSTEM_BINARIES=0

https://learn.microsoft.com/en-us/vcpkg/users/config-environment

dg0yt commented 1 month ago

AFAIK you can't have 2 cmakes at the same time ...

No, there is no limit.

is possible to instruct vcpkg to use its internal CMake instead of an external one. You can achieve this by setting the VCPKG_FORCE_SYSTEM_BINARIES environment variable to 0. This tells vcpkg to use its internal tools, including CMake, rather than any external versions.

Here's how you can set this environment variable:

set VCPKG_FORCE_SYSTEM_BINARIES=0

No, this turns things upside down.

The variable is to enforce the use of system binaries if set.

i remove C:/msys64/ucrt64/ from PATH temply, spdlog build success. But i have to add C:/msys64/ucrt64/ back to PATH, i have other project using C:/msys64/ucrt64/ cmake to compile with. How could i perfectly solve this issue to use two cmake tools?

Can't you just set PATH so that the desired cmake is found first? There is no need for adding MSYS system-wide or user-wide to the PATH.

Basically the one in C:/msys64/ucrt64/bin should work as well (but not the one in C:/msys64/usr/bin!). But did that failing x64-windows (=MSVC) build have all other variables setup correctly for MSVC and Windows SDK?

github-actions[bot] commented 1 week ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.