Skip to content

De-couple the Windows builds from freezing modules. #89351

Closed

Description

@ericsnowcurrently
BPO 45188
Nosy @gvanrossum, @pfmoore, @tjguk, @ericsnowcurrently, @zware, @zooba
PRs
  • bpo-45188: Windows now regenerates frozen modules at the start of build instead of late #28322
  • bpo-45020: Freeze some of the modules imported during startup. #28335
  • 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-09-16.01:15:56.780>
    created_at = <Date 2021-09-13.20:44:06.042>
    labels = ['type-bug', 'OS-windows', 'build', '3.11']
    title = 'De-couple the Windows builds from freezing modules.'
    updated_at = <Date 2021-09-16.01:15:56.779>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2021-09-16.01:15:56.779>
    actor = 'eric.snow'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-16.01:15:56.780>
    closer = 'eric.snow'
    components = ['Build', 'Windows']
    creation = <Date 2021-09-13.20:44:06.042>
    creator = 'eric.snow'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45188
    keywords = ['patch']
    message_count = 10.0
    messages = ['401731', '401735', '401849', '401859', '401868', '401877', '401882', '401907', '401908', '401909']
    nosy_count = 6.0
    nosy_names = ['gvanrossum', 'paul.moore', 'tim.golden', 'eric.snow', 'zach.ware', 'steve.dower']
    pr_nums = ['28322', '28335']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45188'
    versions = ['Python 3.11']

    Activity

    1. ericsnowcurrently commented on Sep 13, 2021

      @ericsnowcurrently
      MemberAuthor

      Currently for Windows builds, generating the frozen modules depends on first building python.exe. One consequence of this is that we must keep all frozen module .h files in the repo (which we'd like to avoid for various reasons).

      We should be able to freeze modules before building python.exe, like we already do via our Makefile. From what I understand, this will require that a subset of the runtime be separately buildable so we can use it in _freeze_module.c and use that before actually building python.exe.

      @Steve, please correct any details I got wrong here. :)

    2. added
      3.11only security fixes
      buildThe build process and cross-build
      type-bugAn unexpected behavior, bug, or error
      on Sep 13, 2021
    3. zooba commented on Sep 13, 2021

      @zooba
      Member

      Only thing I'd add is that you should just be able to list the required .c files in _freeze_module.vcxproj (formerly known as freeze_importlib.vcxproj) rather than depending on pythoncore.vcxproj.

      That will generate twice as many .obj files for those modules (which is fine, just takes a little more time at build), and will force everything to be regenerated if you modify them, but that's an expected part of having part of the interpreter depend upon itself.

    4. ericsnowcurrently commented on Sep 15, 2021

      @ericsnowcurrently
      MemberAuthor

      New changeset cbeb819 by Eric Snow in branch 'main':
      bpo-45020: Freeze some of the modules imported during startup. (gh-28335)
      cbeb819

    5. zooba commented on Sep 15, 2021

      @zooba
      Member

      New changeset 09b4ad1 by Steve Dower in branch 'main':
      bpo-45188: Windows now regenerates frozen modules at the start of build instead of late (GH-28322)
      09b4ad1

    6. gvanrossum commented on Sep 15, 2021

      @gvanrossum
      Member

      Is this now done? I.e. can we now drop the frozen .h files from the repo?

    7. zooba commented on Sep 15, 2021

      @zooba
      Member

      Should be able to, yeah. Though I didn't test that.

    8. gvanrossum commented on Sep 15, 2021

      @gvanrossum
      Member

      I tried this:

      • remove the generated .h files
      • touched dictobject.c
      • touched dictobject.h

      After each step I tried to rebuild. Each case the compilation of frozen.c failed and then the build stopped, so apparently the .h files weren't generated early enough.

      Here's the error message:

      C:\Users\gvanrossum\cpython\Python\frozen.c(44,10): fatal error C1083: Cannot open include file: 'frozen_modules/abc.
      h': No such file or directory [C:\Users\gvanrossum\cpython\PCbuild\pythoncore.vcxproj]

    9. ericsnowcurrently commented on Sep 15, 2021

      @ericsnowcurrently
      MemberAuthor

      FYI, I have a PR up for dropping the .h files: #28375.

    10. ericsnowcurrently commented on Sep 15, 2021

      @ericsnowcurrently
      MemberAuthor

      Can we close this?

    11. gvanrossum commented on Sep 15, 2021

      @gvanrossum
      Member

      We can once #72561 lands.

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesOS-windowsbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions