microsoft / vcpkg

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

[botan] Build error on x64-windows #40276

Closed ni4 closed 3 weeks ago

ni4 commented 1 month ago

Package: botan:x64-windows@3.5.0

Host Environment

To Reproduce

vcpkg install bzip2 zlib json-c getopt dirent botan

Failure logs

-- Downloading https://github.com/randombit/botan/archive/3.5.0.tar.gz -> randombit-botan-3.5.0.tar.gz...
-- Extracting source C:/vcpkg/downloads/randombit-botan-3.5.0.tar.gz
-- Applying patch embed-debug-info.patch
-- Applying patch pkgconfig.patch
-- Applying patch verbose-install.patch
-- Applying patch configure-zlib.patch
-- Applying patch fix_android.patch
-- Applying patch libcxx-winpthread-fixes.patch
-- Applying patch fix-cmake-usage.patch
-- Using source at C:/vcpkg/buildtrees/botan/src/3.5.0-2446fa6972.clean
-- Downloading https://www.python.org/ftp/python/3.11.8/python-3.11.8-embed-amd64.zip -> python-3.11.8-embed-amd64.zip...
-- Found external ninja('1.10.2').
-- Getting CMake variables for x64-windows
-- Getting CMake variables for x64-windows
-- Downloading https://download.qt.io/official_releases/jom/jom_1_1_4.zip;https://mirrors.ocf.berkeley.edu/qt/official_releases/jom/jom_1_1_4.zip;https://mirrors.ukfast.co.uk/sites/qt.io/official_releases/jom/jom_1_1_4.zip -> jom_1_1_4.zip...
-- Prerunning x64-windows-dbg
-- Building and installing x64-windows-dbg
-- Restarting build without parallelism
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/nmake.exe" /NOLOGO /G /U /F Makefile all install INSTALLDIR=C:\\vcpkg\\packages\\botan_x64-windows\\debug "CXX=\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe\"" "LINKER=\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe\"" "AR=\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/lib.exe\"" "EXE_LINK_CMD=\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe\" " ZLIB_LIBS=
    Working Directory: C:/vcpkg/buildtrees/botan/x64-windows-dbg
    See logs for more information:
      C:\vcpkg\buildtrees\botan\install-x64-windows-dbg-nmake-out.log
      C:\vcpkg\buildtrees\botan\install-x64-windows-dbg-nmake-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_nmake.cmake:156 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_nmake.cmake:52 (vcpkg_build_nmake)
  ports/botan/portfile.cmake:107 (vcpkg_install_nmake)
  scripts/ports.cmake:192 (include)
C:\vcpkg\buildtrees\botan\install-x64-windows-dbg-nmake-err.log ``` NMAKE : fatal error U1077: '"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"' : return code '0x2' Stop. ```
C:\vcpkg\buildtrees\botan\install-x64-windows-dbg-nmake-out.log ``` "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" /std:c++20 /EHs /GR /D_WIN32_WINNT=0x0600 /MDd /bigobj /Z7 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP /W4 /wd4251 /wd4275 /wd5072 -DBOTAN_IS_BEING_BUILT /I build/include/public /I build/include/internal /external:W0 /external:I build/include/external /external:W0 /external:I C:/vcpkg/installed/x64-windows/include /nologo /c C:/vcpkg/buildtrees/botan/src/3.5.0-2446fa6972.clean/src/tests/test_utils_buffer.cpp /Fobuild/obj/test/test_utils_buffer.obj test_utils_buffer.cpp C:\vcpkg\buildtrees\botan\x64-windows-dbg\build\include\internal\botan/internal/stl_util.h(227): error C2131: expression did not evaluate to a constant C:\vcpkg\buildtrees\botan\x64-windows-dbg\build\include\internal\botan/internal/stl_util.h(227): note: failure was caused by a read of a variable outside its lifetime C:\vcpkg\buildtrees\botan\x64-windows-dbg\build\include\internal\botan/internal/stl_util.h(227): note: see usage of 'this' C:\vcpkg\buildtrees\botan\x64-windows-dbg\build\include\internal\botan/internal/stl_util.h(264): note: see reference to function template instantiation 'OutR Botan::detail::concatenate&,const std::array&>(const std::array &,const std::array &)' being compiled with [ OutR=out_array_t ] C:/vcpkg/buildtrees/botan/src/3.5.0-2446fa6972.clean/src/tests/test_utils_buffer.cpp(627): note: see reference to function template instantiation 'OutR Botan::concat&,const std::array&>(const std::array &,const std::array &)' being compiled with [ OutR=out_array_t ] C:/vcpkg/buildtrees/botan/src/3.5.0-2446fa6972.clean/src/tests/test_utils_buffer.cpp(627): note: while evaluating constexpr function 'Botan::concat' ```
ni4 commented 1 month ago

JFYI: This happens when attempting to build Botan via Github Actions for the RNP project.

P.S. How new projects could be added to the vcpkg? I think RNP is mature enough for this. Should I do a pull request/create an issue for that? Thanks!

ni4 commented 1 month ago

Not sure whether it would be helpful, but here is link to the action which produces this issue: https://github.com/rnpgp/rnp/actions/runs/10216412857/job/28267833000?pr=2258

ni4 commented 3 weeks ago

@WangWeiLin-MV hi, any progress or plans on this, as it blocks our CI. Or should I research the way to use non-latest vcpkg package (whether it is allowed at all, at first glance didn't find a good one).

WangWeiLin-MV commented 3 weeks ago

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

According to your log, it seems that the error is from source code or standard library.

they way to use non-latest vcpkg

Since the upstream uses the built-in vcpkg of GitHub action, it is recommended to upgrade to windows-2022, or a rough but fast method is to fall back its version by git reset --hard ef7c629803a875b2a2bb8ea6ee217a1ee644b5d3, which commit is the last snapshot of botan 3.3.0#2.

The recommended workflow is manifest mode, see Tutorial: Install a specific version of a package

ni4 commented 3 weeks ago

Thanks for the explanation and for the hints! It's really seems to be a good time to migrate to windows-2022 runner, given that soon we'll have 2025 abandoning the 2019 one. Closing this.