microsoft / vcpkg

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

[mpir] build failure #36288

Open GitMensch opened 8 months ago

GitMensch commented 8 months ago

Operating system

Windows

Compiler

MSCV

Steps to reproduce the behavior

./vcpgk install mpir:x86-windows

Failure logs

console output

Installing mpir:x86-windows@2022-03-02#3...
Building mpir:x86-windows@2022-03-02#3...
-- Downloading https://github.com/wbhart/mpir/archive/cdd444aedfcbb190f00328526ef278428702d56e.tar.gz -> wbhart-mpir-cdd444aedfcbb190f00328526ef278428702d56e.tar.gz...
-- Extracting source C:/Tools/vcpkg/downloads/wbhart-mpir-cdd444aedfcbb190f00328526ef278428702d56e.tar.gz
-- Applying patch enable-runtimelibrary-toggle.patch
-- Applying patch fix-static-include-files.patch
-- Using source at C:/Tools/vcpkg/buildtrees/mpir/src/428702d56e-def7e839da.clean
-- Getting CMake variables for x86-windows
-- Building build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj for Release
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: msbuild C:/Tools/vcpkg/buildtrees/mpir/x86-windows-rel/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj /p:Configuration=Release /p:ForceImportAfterCppProps=C:/Tools/vcpkg/buildtrees/mpir/x86-windows/vcpkg_msbuild.props /p:ForceImportAfterCppTargets=C:/Tools/vcpkg/buildtrees/mpir/x86-windows/vcpkg_msbuild.targets /t:Rebuild /p:UseMultiToolTask=true /p:MultiProcMaxCount=3 /p:EnforceProcessCountAcrossBuilds=true /m:3 -maxCpuCount:3 /p:Platform=Win32 /p:PlatformTarget=x86 /p:PlatformToolset=v140 /p:WindowsTargetPlatformVersion=10.0.18362.0 /p:VcpkgApplocalDeps=false /p:VcpkgManifestInstall=false /p:VcpkgManifestEnabled=false /p:VcpkgEnabled=false /p:VcpkgTriplet=x86-windows /p:VcpkgInstalledDir=C:/Tools/vcpkg/installed
    Working Directory: C:/Tools/vcpkg/buildtrees/mpir/x86-windows-rel
    Error code: 1
    See logs for more information:
      C:\Tools\vcpkg\buildtrees\mpir\build-x86-windows-rel-out.log
Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-msbuild/vcpkg_msbuild_install.cmake:108 (vcpkg_execute_required_process)
  ports/mpir/portfile.cmake:52 (vcpkg_msbuild_install)
  scripts/ports.cmake:170 (include)
error: building mpir:x86-windows failed with: BUILD_FAILED
Elapsed time to handle mpir:x86-windows: 7.7 s

C:\Tools\vcpkg\buildtrees\mpir\build-x86-windows-rel-out.log


Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/21/2024 1:39:05 PM.
     1>Project "C:\Tools\vcpkg\buildtrees\mpir\x86-windows-rel\build.vc14\dll_mpir_gc\dll_mpir_gc.vcxproj" on node 1 (Rebuild target(s)).
     1>C:\Tools\vcpkg\buildtrees\mpir\x86-windows\vcpkg_msbuild.targets(29,16): error MSB4066: The attribute "Update" in element <ClCompile> is unrecognized. [C:\Tools\vcpkg\buildtrees\mpir\x86-windows-rel\build.vc14\dll_mpir_gc\dll_mpir_gc.vcxproj]
     1>Done Building Project "C:\Tools\vcpkg\buildtrees\mpir\x86-windows-rel\build.vc14\dll_mpir_gc\dll_mpir_gc.vcxproj" (Rebuild target(s)) -- FAILED.

Build FAILED.

       "C:\Tools\vcpkg\buildtrees\mpir\x86-windows-rel\build.vc14\dll_mpir_gc\dll_mpir_gc.vcxproj" (Rebuild target) (1) ->
         C:\Tools\vcpkg\buildtrees\mpir\x86-windows\vcpkg_msbuild.targets(29,16): error MSB4066: The attribute "Update" in element <ClCompile> is unrecognized. [C:\Tools\vcpkg\buildtrees\mpir\x86-windows-rel\build.vc14\dll_mpir_gc\dll_mpir_gc.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.46

### Additional context

This did work 6 months ago, so if nothing changed on the appveyor side (which is used to do this build as a dependency) then some of the changes here must have created this issue.
Also happens on x64. Works fine with newer MSVC/build environment.
autoantwort commented 8 months ago

Does this also apply to you: https://github.com/SpecFlowOSS/SpecFlow/issues/1250#issuecomment-415782071 ?

GitMensch commented 8 months ago

As noted the newer MSBuild (from VS2017) does work, but the goal is to run that with a VS2015 stack (which worked before).

autoantwort commented 7 months ago

Was probably changed in https://github.com/microsoft/vcpkg/pull/33142

GitMensch commented 5 months ago

@Neumann-A Can you please verify if this failure is related to your changes (and possibly how to work around that without reversing the commit)?

Neumann-A commented 5 months ago

You should really be using VS 2022 with the v140 toolset instead of expecting that a 2023 change will work with VS2015. There is probably a workaround by using an overlay for vcpkg-msbuild removing the problematic field but I am not going to investigate that possibility.

GitMensch commented 5 months ago

vcpkg says that VC2015 is expected to work.

It is not that I'd like to keep that forever, but I do know some people/companies still use VC2015 and have VC2015 generated DLLs that need to work toghether, so "just using a newer toolset" is likely not what will work there.

Is it possible to request to use an older definition? Maybe by updating the ports definitions, then manually downgrading the mpir definition to the last version that worked before installing?

Neumann-A commented 5 months ago

V140 is the old toolset which can be installed via the installer. Just use a newer MSBuild/Visual Studio

If you use manifest mode you can pin whatever version you like.

GitMensch commented 2 months ago

Found the issue - it is actually a bug in vcpkg_msbuild_install, it works when moving back to the deprecated vcpkg_install_msbuild instead (only copy/replace).

@Neumann-A can you please do that?

.. wait, that builds but not install correctly:

C:\Tools\vcpkg\ports\mpir\portfile.cmake: warning: The folder ${CURRENT_PACKAGES_DIR}/include is empty or not present. This usually means that headers are not correctly installed. If this is a CMake helper port, add set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled). If this is not a CMake helper port but this is otherwise intentional, add set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) to suppress this message. C:\Tools\vcpkg\ports\mpir\portfile.cmake: warning: There should be no installed empty directories. Empty directories are not representable to several binary cache providers, git repositories, and are not considered semantic build outputs. You should either create a regular file inside each empty directory, or delete them with the following CMake. To suppress this message, add set(VCPKG_POLICY_ALLOW_EMPTY_FOLDERS enabled) C:\Tools\vcpkg\packages\mpir_x86-windows: note: the directories are relative to ${CURRENT_PACKAGES_DIR} here note: file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include") C:\Tools\vcpkg\ports\mpir\portfile.cmake: warning: Found 2 post-build check problem(s). These are usually caused by bugs in portfile.cmake or the upstream build system. Please correct these before submitting this port to the curated registry. Stored binaries in 1 destinations in 860 ms.

Any hint what I need to add/adjust to get that fixed?