Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows build cannot detect missing Windows SDK #87464

Closed
mytechnotalent mannequin opened this issue Feb 22, 2021 · 11 comments
Closed

Windows build cannot detect missing Windows SDK #87464

mytechnotalent mannequin opened this issue Feb 22, 2021 · 11 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes build The build process and cross-build

Comments

@mytechnotalent
Copy link
Mannequin

mytechnotalent mannequin commented Feb 22, 2021

BPO 43298
Nosy @jaraco, @ambv, @zooba, @pablogsal, @miss-islington, @mytechnotalent
PRs
  • bpo-43298: Improved error message when building without the Windows SDK installed #26800
  • [3.10] bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) #26802
  • [3.9] bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) #26803
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-06-19.12:50:16.559>
    created_at = <Date 2021-02-22.17:25:51.173>
    labels = ['build', '3.9', '3.10', '3.11']
    title = 'Windows build cannot detect missing Windows SDK'
    updated_at = <Date 2021-07-12.15:11:37.317>
    user = 'https://github.com/mytechnotalent'

    bugs.python.org fields:

    activity = <Date 2021-07-12.15:11:37.317>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-06-19.12:50:16.559>
    closer = 'steve.dower'
    components = []
    creation = <Date 2021-02-22.17:25:51.173>
    creator = 'mytechnotalent'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43298
    keywords = ['patch']
    message_count = 11.0
    messages = ['387518', '387529', '387533', '387561', '387563', '395530', '395666', '396131', '396195', '397050', '397324']
    nosy_count = 8.0
    nosy_names = ['jaraco', 'lukasz.langa', 'steve.dower', 'pablogsal', 'miss-islington', 'mytechnotalent', 'Zack_Barton', 'White1']
    pr_nums = ['26800', '26802', '26803']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue43298'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @mytechnotalent
    Copy link
    Mannequin Author

    mytechnotalent mannequin commented Feb 22, 2021

    When compiling for Windows it does not properly handle the version string MSB4184

    C:\Users\kevin\cpython>PCbuild\build.bat
    Using py -3.7 (found 3.7 with py.exe)
    Fetching external libraries...
    bzip2-1.0.6 already exists, skipping.
    sqlite-3.34.0.0 already exists, skipping.
    xz-5.2.2 already exists, skipping.
    zlib-1.2.11 already exists, skipping.
    Fetching external binaries...
    libffi already exists, skipping.
    openssl-bin-1.1.1i already exists, skipping.
    tcltk-8.6.10.0 already exists, skipping.
    Finished.
    Using "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" (found in the Visual Studio installation)

    C:\Users\kevin\cpython>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" "C:\Users\kevin\cpython\PCbuild\pcbuild.proj" /t:Build /m /nologo /v:m /clp:summary /p:Configuration=Release /p:Platform=x64 /p:IncludeExternals=true /p:IncludeCTypes=true /p:IncludeSSL=true /p:IncludeTkinter=true /p:UseTestMarker= /p:GIT="C:\Program Files\Git\cmd\git.exe"
    C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot
    be evaluated. Version string portion was too short or too long. [C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]

    Build FAILED.

    C:\Users\kevin\cpython\PCbuild\python.props(111,31): error MSB4184: The expression "[System.Version]::Parse('')" cannot
    be evaluated. Version string portion was too short or too long. [C:\Users\kevin\cpython\PCbuild\pythoncore.vcxproj]
    0 Warning(s)
    1 Error(s)

    Time Elapsed 00:00:00.06

    @mytechnotalent mytechnotalent mannequin added 3.10 only security fixes build The build process and cross-build labels Feb 22, 2021
    @zooba
    Copy link
    Member

    zooba commented Feb 22, 2021

    This should mean that you haven't got the Windows SDK installed, though it might mean that you've got a *newer* WinSDK where they've changed the registration format.

    But more likely you deselected it when installing C++ support through Visual Studio. Could you open Visual Studio Installer and ensure that the newest Windows SDK item is selected?

    Assuming the spammers go away, we can use this bug to improve the error message. If they persist, we'll lock this and open a new one.

    @zooba zooba changed the title Windows build issue Windows build cannot detect missing Windows SDK Feb 22, 2021
    @zooba zooba changed the title Windows build issue Windows build cannot detect missing Windows SDK Feb 22, 2021
    @mytechnotalent
    Copy link
    Mannequin Author

    mytechnotalent mannequin commented Feb 22, 2021

    Thank you Steve. I did not have the latest installed which is Win10SDK_10.0.18362, therefore it did trigger that original error in msg387518.

    After installing, Win10SDK_10.0.18362, it did in-fact allow a successful compilation.

    Updating that error code would be most helpful to Windows developers. I would have never caught it but I wanted to help test 3.10 so I thought I should try it on the Windows 10 box to make sure the community had all platforms covered.

    RESULTS:
    Build succeeded.
    0 Warning(s)
    0 Error(s)

    Time Elapsed 00:01:10.34

    C:\Users\kevin\cpython>python.bat
    Running Release|x64 interpreter...
    Python 3.10.0a5+ (heads/master:91a639a094, Feb 22 2021, 14:01:03) [MSC v.1928 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.

    >>

    @zooba
    Copy link
    Member

    zooba commented Feb 23, 2021

    I did not have the latest installed which is Win10SDK_10.0.18362, therefore it did trigger that original error in msg387518.

    Did you have any other version installed? It should include one by
    default, which is why we don't mention it in the quick instructions, but
    I think you can remove it at install time.

    @mytechnotalent
    Copy link
    Mannequin Author

    mytechnotalent mannequin commented Feb 23, 2021

    Hi Steve actually there was none installed which was strange as I had Visual Studio installed but it was not checked by default. After selecting it and installing it, everything works as expected. Updating the error message in some way might be helpful.

    @jaraco
    Copy link
    Member

    jaraco commented Jun 10, 2021

    In bpo-44246, I've encountered this error while attempting to build CPython in a Docker image (built from https://github.com/jaraco/jaraco.windows/blob/d2edad2e2af9d469189d7ac6a14a4ba6f6270348/Dockerfile). Any suggestions on how to install the SDK to a viable version in a headless environment?

    @zooba
    Copy link
    Member

    zooba commented Jun 11, 2021

    Jason - I think your -add and -remove options need work. I'm pretty sure the AzureBuildTools component doesn't bring in the C++ compilers or the WinSDK.

    If you configure it manually and interactively, you should be able to export a JSON configuration and then you can use that later to recreate the install elsewhere.

    @zooba
    Copy link
    Member

    zooba commented Jun 19, 2021

    New changeset 80190b3 by Steve Dower in branch 'main':
    bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800)
    80190b3

    @zooba zooba added 3.9 only security fixes 3.11 bug and security fixes labels Jun 19, 2021
    @zooba zooba closed this as completed Jun 19, 2021
    @zooba zooba added 3.9 only security fixes 3.11 bug and security fixes labels Jun 19, 2021
    @zooba zooba closed this as completed Jun 19, 2021
    @pablogsal
    Copy link
    Member

    New changeset 5fbccb7 by Miss Islington (bot) in branch '3.10':
    bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (GH-26802)
    5fbccb7

    @jaraco
    Copy link
    Member

    jaraco commented Jul 6, 2021

    I was able to export the configuration using these instructions: https://docs.microsoft.com/en-us/visualstudio/install/import-export-installation-configurations?view=vs-2019

    That produced this config:

    {
    "version": "1.0",
    "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Windows10SDK.19041",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.Workload.NativeDesktop"
    ]
    }

    Using that, I tried to install those components using vs_buildtools:

    # Install Visual Studio
    RUN ./vs_buildtools.exe --quiet --wait --norestart --nocache \
    --add Microsoft.VisualStudio.Component.CoreEditor \
    --add Microsoft.VisualStudio.Workload.CoreEditor \
    --add Microsoft.VisualStudio.Component.Roslyn.Compiler \
    --add Microsoft.Component.MSBuild \
    --add Microsoft.VisualStudio.Component.TextTemplating \
    --add Microsoft.VisualStudio.Component.VC.CoreIde \
    --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
    --add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
    --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \
    --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core \
    --add Microsoft.VisualStudio.Workload.NativeDesktop

    In order to avoid noise here, I'm going to continue the investigation in jaraco/jaraco.windows#21.

    @ambv
    Copy link
    Contributor

    ambv commented Jul 12, 2021

    New changeset e7009f4 by Miss Islington (bot) in branch '3.9':
    bpo-43298: Improved error message when building without the Windows SDK installed (GH-26800) (bpo-26803)
    e7009f4

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants