microsoft / vcpkg

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

[upb] Build failure on x64-windows #39177

Closed dbolduc closed 1 month ago

dbolduc commented 4 months ago

Operating system

windows, x64 and x86

Compiler

MSVC - CL 19.40.33811

Steps to reproduce the behavior

./vcpkg install upb[codegen,core]

Failure logs

-- Building x64-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: "C:/Program Files/CMake/bin/cmake.exe" --build . --config Debug --target install -- -v -j5
    Working Directory: C:/Users/runneradmin/AppData/Local/Temp/.build/vcpkg/buildtrees/upb/x64-windows-dbg
    See logs for more information:
      C:\Users\runneradmin\AppData\Local\Temp\.build\vcpkg\buildtrees\upb\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  C:/b/vcpkg_installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  C:/b/vcpkg_installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/upb/portfile.cmake:39 (vcpkg_cmake_install)
  scripts/ports.cmake:175 (include)

error: building upb:x64-windows failed with: BUILD_FAILED

I do not have the full logs available.

Additional context

Ok, here is the important thing. This built every time with:

Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33523 for x64

Now we see it fail every time with:

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33811 for x64

https://github.com/googleapis/google-cloud-cpp/actions/runs/9391776127/job/25864698590?pr=14303


Someone else wrote a better bug report than me: https://github.com/protocolbuffers/protobuf/issues/17032

If vcpkg is not the place to fix this, close the issue.

LilyWangLL commented 4 months ago

I can't repro this issue locally, I can install upb[codegen,core]:x64-windows succeed on the latest vcpkg.

Installing 2/2 upb[codegen,core]:x64-windows@2022-06-21#1...
Building upb[codegen,core]:x64-windows@2022-06-21#1...
-- Note: upb only supports static library linkage. Building static library.
-- Downloading https://github.com/protocolbuffers/upb/archive/e4635f223e7d36dfbea3b722a4ca4807a7e882e2.tar.gz -> protocolbuffers-upb-e4635f223e7d36dfbea3b722a4ca4807a7e882e2.tar.gz...
-- Extracting source F:/0530/downloads/protocolbuffers-upb-e4635f223e7d36dfbea3b722a4ca4807a7e882e2.tar.gz
-- Applying patch 0001-make-cmakelists-py.patch
-- Applying patch 0002-fix-uwp.patch
-- Using source at F:/0530/buildtrees/upb/src/07a7e882e2-67ea24d098.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: F:/0530/packages/upb_x64-windows/share/upb/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 473 ms.
Elapsed time to handle upb:x64-windows: 14 s
upb:x64-windows package ABI: 7cc8351f68c9cc4feb6451c0e6daadd3b6c9a6eda850bc6a790d53f6147fc730
Total install time: 1.7 min
upb provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(upb CONFIG REQUIRED)
  # note: 9 additional targets are not displayed.
  target_link_libraries(main PRIVATE upb::upb upb::json upb::port upb::table)

 .\vcpkg.exe --version
vcpkg package management program version 2024-04-23-d6945642ee5c3076addd1a42c331bbf4cfc97457
dbolduc commented 4 months ago

I can't repro this issue locally

What compiler are you using? Can you try with CL 19.40.33811, which ships with MSVC 14.40.33807?

mnixry commented 4 months ago

Same issue here. I can replicate this failure with my GitHub Actions job (https://github.com/mnixry/proton-bridge/actions/runs/9475030049/job/26105677527).

dbolduc commented 4 months ago

We saw these failures in our GHA jobs. We reverted the builds to using the MSVC 2019 compiler (14.29) for now (VCPKG_PLATFORM_TOOLSET_VERSION). Hopefully upb will build with 14.41 and we can remove the workarounds later.

if it helps, here is the hackery we used:

https://github.com/googleapis/google-cloud-cpp/blob/dfed337b942b940b827782464a5331319c2e519f/.github/workflows/windows-cmake.yml#L64-L87

https://github.com/googleapis/google-cloud-cpp/blob/dfed337b942b940b827782464a5331319c2e519f/.github/workflows/windows-cmake.yml#L238-L240

JamieStM commented 4 months ago

I'm seeing the same error on my GHA jobs. When I run cat "<buildtrees>/upb/install-x64-windows-dbg-out.log" afterwards, the failure is:

[25/44] cmd.exe /C "cd /D <vcpkg_installed>\vcpkg\blds\upb\x64-windows-dbg && <vcpkg_installed>\x64-windows\tools\protobuf\protoc.exe -I<vcpkg_installed>/x64-windows/include --plugin=protoc-gen-upb=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/protoc-gen-upb.exe --plugin=protoc-gen-upbdefs=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/protoc-gen-upbdefs.exe --upb_out=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg --upbdefs_out=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg <vcpkg_installed>/x64-windows/include/google/protobuf/descriptor.proto"

FAILED: google/protobuf/descriptor.upb.h google/protobuf/descriptor.upb.c google/protobuf/descriptor.upbdefs.h google/protobuf/descriptor.upbdefs.c <vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/google/protobuf/descriptor.upb.h <vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/google/protobuf/descriptor.upb.c <vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/google/protobuf/descriptor.upbdefs.h <vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/google/protobuf/descriptor.upbdefs.c 

cmd.exe /C "cd /D <vcpkg_installed>\vcpkg\blds\upb\x64-windows-dbg && <vcpkg_installed>\x64-windows\tools\protobuf\protoc.exe -I<vcpkg_installed>/x64-windows/include --plugin=protoc-gen-upb=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/protoc-gen-upb.exe --plugin=protoc-gen-upbdefs=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg/protoc-gen-upbdefs.exe --upb_out=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg --upbdefs_out=<vcpkg_installed>/vcpkg/blds/upb/x64-windows-dbg <vcpkg_installed>/x64-windows/include/google/protobuf/descriptor.proto"

ninja: build stopped: subcommand failed.

The workaround provided by @dbolduc worked for us, although with the caveat that we had to build our code with the 14.40 toolset, while building our dependencies with the 14.29 toolset (i.e. we omitted the line here: https://github.com/googleapis/google-cloud-cpp/blob/dfed337b942b940b827782464a5331319c2e519f/.github/workflows/windows-cmake.yml#L251). MSVC is ostensibly ABI-compatible across versions so it works for us.

github-actions[bot] commented 3 months 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.

dbolduc commented 3 months ago

bump

dbolduc commented 1 month ago

Hopefully upb will build with 14.41 and we can remove the workarounds later.

FYI, upb does build with 14.41. I am just going to close this issue.