Vcpkg: Error: Building package python3:x64-windows failed with: BUILD_FAILED

Created on 6 Apr 2019  ·  17Comments  ·  Source: microsoft/vcpkg

Windows 10 latest updates. Almost clean new laptop.
Visual Studio 2015 Update 3.
Today's master branch.

PS D:\OSG\base\vcpkg> .\vcpkg.exe install boost:x64-windows
The following packages will be built and installed:
    boost[core]:x64-windows
  * boost-parameter-python[core]:x64-windows
  * boost-poly-collection[core]:x64-windows
  * boost-process[core]:x64-windows
  * boost-program-options[core]:x64-windows
  * boost-python[core]:x64-windows
  * boost-sort[core]:x64-windows
  * boost-stacktrace[core]:x64-windows
  * boost-statechart[core]:x64-windows
  * boost-wave[core]:x64-windows
  * boost-yap[core]:x64-windows
  * python3[core]:x64-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/12: python3:x64-windows
Building package python3[core]:x64-windows...
-- Using cached D:/OSG/base/vcpkg/downloads/python-cpython-v3.7.3.tar.gz
-- Extracting source D:/OSG/base/vcpkg/downloads/python-cpython-v3.7.3.tar.gz
-- Using source at D:/OSG/base/vcpkg/buildtrees/python3/src/v3.7.3-1161ad7a91
-- Building D:/OSG/base/vcpkg/buildtrees/python3/src/v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic/PCBuild/pythoncore.vcxproj for Release
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
    Command failed: msbuild;D:/OSG/base/vcpkg/buildtrees/python3/src/v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic/PCBuild/pythoncore.vcxproj;/p:Configuration=Release;/t:Rebuild;/p:Platform=x64;/p:PlatformToolset=v140;/p:VCPkgLocalAppDataDisabled=true;/p:UseIntelMKL=No;/p:WindowsTargetPlatformVersion=;/m
    Working Directory: D:/OSG/base/vcpkg/buildtrees/python3/x64-windows-rel
    Error code: 1
    See logs for more information:
      D:\OSG\base\vcpkg\buildtrees\python3\build-x64-windows-rel-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_msbuild.cmake:119 (vcpkg_execute_required_process)
  ports/python3/portfile.cmake:37 (vcpkg_build_msbuild)
  scripts/ports.cmake:71 (include)


Error: Building package python3:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: python3:x64-windows
  Vcpkg version: 2018.11.23-nohash

Additionally, attach any relevant sections from the log files above.

build-x64-windows-rel-out.log:

````
Microsoft (R) Build Engine версии 14.0.25420.1
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

Сборка начата 06.04.2019 13:16:31.
1>Проект "D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" в узле 1 (целевые объекты Rebuild).
1>D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\python.props(85,31): error MSB4184: не удается вычислить выражение "[System.Version]::Parse('')". Слишком кроткая или длинная часть строки версии. [D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj]
1>Сборка проекта "D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" завершена (целевые объекты Rebuild) с ошибкой.

Ошибка сборки.

   "D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" (целевой объект Rebuild ) (1) ->
     D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\python.props(85,31): error MSB4184: не удается вычислить выражение "[System.Version]::Parse('')". Слишком кроткая или длинная часть строки версии. [D:\OSG\base\vcpkg\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj]

Предупреждений: 0
Ошибок: 1

Затраченное время: 00:00:00.01
```

port-bug

Most helpful comment

can anyone please fix this problem ? I am facing same problem.

All 17 comments

мало инфы\логов
а так у тебя все написано

can anyone please fix this problem ? I am facing same problem.

Package: python3:x64-windows
Vcpkg version: 2019.06.26-nohash

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

Build started 7/15/2019 2:31:36 PM.
1>Project "E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" on node 1 (Rebuild target(s)).
1>E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\python.props(85,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. [E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj]
1>Done Building Project "E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" (Rebuild target(s)) -- FAILED.

Build FAILED.

   "E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj" (Rebuild target) (1) ->
     E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\python.props(85,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. [E:\OpenFOAM\Javad-3.0.x\mrst-2019a_zip\vcpkg-master\buildtrees\python3\src\v3.7.3-1161ad7a91-Lib-dynamic-crt-dynamic\PCBuild\pythoncore.vcxproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.02`

I also experienced this exact issue using Visual Studio 2015, specifically Update 3. See #8138 for details

Here is the source of the issue in the code

  <PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
    <!--
    Attempt to select the latest installed WinSDK. If we don't find any, then we will
    let the MSBuild targets determine which one it wants to use (typically the earliest
    possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
    matter which WinSDK version we use.
    -->
    <_RegistryVersion>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
    <_RegistryVersion Condition="$(_RegistryVersion) == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</_RegistryVersion>
    <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it -->
    <_RegistryVersion Condition="$(_RegistryVersion) != '' and !$(_RegistryVersion.EndsWith('.0'))">$(_RegistryVersion).0</_RegistryVersion>

    <!-- The minimum allowed SDK version to use for building -->
    <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
    ******PROBLEM LINE******<DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion> ******PROBLEM LINE******
  </PropertyGroup>

I navigated to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10 in my registry and noticed that it did not exist. I also navigated to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0 and that did no exist either. I'm reinstalling the Windows SDK from here. If this resolves the issue, i'll report back here.

After installing the Windows SDK and restarting, nothing seemed to change. It looks like the version numbers still don't exist in the windows registry.

I was able to resolve this issue after opening the Visual Studio set up, clicking 'modify', and checking off the 'Universal Windows App Development Tools' option. Maybe adding an error message here that reminds the user to make sure its installed, or possibly a readme in the python3 directory.

minimum allowed SDK version to use for building -->
10.0.10586.0

not latest

After removing the Windows SDK related code in SOURCE_PATH/PCbuild/python.props, it works fine.
Here is my patch:
fix-win-sdk-error.zip
Can anyone test it? Thanks. And I can't guarantee that using the Windows SDK below version 10 to build a python3 generated library is correct.

If it works with any version of Visual Studio, I will make a PR to fix this.

@vpaladino778 You need to install the Windows SDK by Control Panel - Programs and Features - Visual Studio 2015 - change(Visual Studio 2015) / Visual Studio Installer (Visual Studio 2017+).

Manually installing the Windows SDK may cause the registry to fail to write.

Facing same issue in VS2015 update 3 with latest pull . Installed SDK is in screenshot

image

Did the following steps
1) Remove Windows SDK from VS2015 setup
2) Reinstall with modify VS2015 feature.

Still same issue. Any idea how to solve ?

I fixed it when i opened up the installer, hit modify, and selected Update three. I had installed the windows SDK separately, but that did not help. I believe i installed it from here. If you did the same, i would try uninstalling it.

I think problem is different as per log it shows this

Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : Configuration error MSB4148: The name of a property stored under the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0" has zero length.

@nareshn2003 Yes, installing Windows SDK without administrator privileges will result in no permission to write to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0, causing python3 build to fail.

I fixed it when i opened up the installer, hit modify, and selected Update three. I had installed the windows SDK separately, but that did not help. I believe i installed it from here. If you did the same, i would try uninstalling it.

Did the same nothing worked so far . Also reinstall visual studio and windows sdk but still same problem. I am not sure why it looks for MSBuild Tools Version 2.0 in registry ?

After reinstall fresh copy of windows 10 and visual studio worked fine.

Why this issue happened:

When the Windows SDK is installed, some paths are written to the registry. Other programs obtain the Windows SDK path by reading the registry. Manual installation of the Windows SDK may cause this issue in no write registry permissions, but no warning after installation.

How can I solve this issue:

Use Visual Studio Installer to reinstall the Windows SDK after uninstalling the Windows SDK.

Related: #7128.

Was this page helpful?
0 / 5 - 0 ratings