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 fails with error C2039 in deepfreeze.c #94781

Closed
pfmoore opened this issue Jul 12, 2022 · 10 comments
Closed

Windows build fails with error C2039 in deepfreeze.c #94781

pfmoore opened this issue Jul 12, 2022 · 10 comments
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@pfmoore
Copy link
Member

pfmoore commented Jul 12, 2022

Bug report

Building CPython on windows fails with the following error:

❯ .\build.bat
Using py -3.10 (found 3.10 with py.exe)
Fetching external libraries...
bzip2-1.0.8 already exists, skipping.
sqlite-3.38.4.0 already exists, skipping.
xz-5.2.5 already exists, skipping.
zlib-1.2.12 already exists, skipping.
Fetching external binaries...
libffi-3.4.2 already exists, skipping.
openssl-bin-1.1.1n already exists, skipping.
tcltk-8.6.12.1 already exists, skipping.
Finished.
Using "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe" (found in the Visual Studio installation)
Using py -3.10 (found 3.10 with py.exe)

C:\Work\Projects\cpython\PCbuild>"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe" "C:\Work\Projects\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:\Users\Gustav\scoop\shims\git.exe"
  _freeze_module.vcxproj -> C:\Work\Projects\cpython\PCbuild\win32\_freeze_module.exe
  Killing any running python.exe instances...
  Generated sources are up to date
  Getting build info from C:\Users\Gustav\scoop\shims\git.exe
  Building heads/main:cfafd3adf8 main
  deepfreeze.c
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48335,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Include\internal\pycore_global_strings.h(54): message : see declaration of '<unnamed-tag>' [C:
\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48436,17): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Include\internal\pycore_global_strings.h(54): message : see declaration of '<unnamed-tag>' [C:
\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48437,21): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Include\internal\pycore_global_strings.h(54): message : see declaration of '<unnamed-tag>' [C:
\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(52201,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Include\internal\pycore_global_strings.h(54): message : see declaration of '<unnamed-tag>' [C:
\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(52297,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Include\internal\pycore_global_strings.h(54): message : see declaration of '<unnamed-tag>' [C:
\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]

Build FAILED.

C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48335,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48436,17): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(48437,21): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(52201,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
C:\Work\Projects\cpython\Python\deepfreeze\deepfreeze.c(52297,14): error C2039: '_zipimporter': is not a member of '<un
named-tag>' [C:\Work\Projects\cpython\PCbuild\pythoncore.vcxproj]
    0 Warning(s)
    5 Error(s)

Time Elapsed 00:00:07.59

This is from a clean checkout of https://github.com/python/cpython, changing directory to PCBuild and running ./build.bat

Your environment

My system is Windows 11, with Visual Studio 2022 and Visual Studio 2019 installed. As can be seen from the messages, VS2022 is picked by build.bat.

  • CPython versions tested on: main branch commit cfafd3a
  • Operating system and architecture: Windows 11, 64-bit
@pfmoore pfmoore added the type-bug An unexpected behavior, bug, or error label Jul 12, 2022
@pfmoore pfmoore changed the title Windows build fails with Windows build fails with error C2039 in deepfreeze.c Jul 12, 2022
@arhadthedev
Copy link
Member

Does the problem disappear after deletion of Python\deepfreeze\* and Python\frozen_modules\* with the following rebuilding?

I get the very same problem after git pull/checkout and the deletion helps. Probably, git fails to update file modification dates?

@pfmoore
Copy link
Member Author

pfmoore commented Jul 12, 2022

That seems to have fixed it, thanks. I'm pretty sure I did at least one of those deletions, deleting both directories seems to have been the key.

Maybe PCBuild\clean.bat should delete those files? I'd tried that expecting it to reset everything, and was surprised when it didn't work.

@Fidget-Spinner
Copy link
Member

@kumaraditya303 git clean -fdX as a workaround and that worked for me. However, I agree that clean.bat should do something about those files.

Copy link
Member

Rather than adding cleanup logic to clean.bat directly, can the Clean target of the project file that creates the files in question be taught how to clean them up? clean.bat is itself intentionally very bare-bones.

@CharlieZhao95
Copy link
Contributor

Rather than adding cleanup logic to clean.bat directly, can the Clean target of the project file that creates the files in question be taught how to clean them up? clean.bat is itself intentionally very bare-bones.

The build still fails after executing the clean.bat which is unexpected result, and the reason for the failure is indeed that some files were not deleted correctly.

For users, executing clean.bat first and then build successfully is probably the simplest and best result.

It's good advice to provide a more detailed build guide to teach users how to cleanup previous files and solve these potential problems, and I feel like it should. Also, it doesn't seem like adding logic to clean.bat will negatively affect the build process either. Maybe we coud do both.

Copy link
Member

My point is that clean.bat itself is the wrong place to add cleanup logic. I agree that the act of calling clean.bat should be sufficient to allow a successful build, but the place to make that happen is in the cleanup steps of the project files that generate the problematic files which clean.bat invokes.

@CharlieZhao95
Copy link
Contributor

Thanks for your detailed reply. I may have misinterpreted your previous message.
I will learn about the clean target in MSbuild later :)

@CharlieZhao95
Copy link
Contributor

#96423 I modified the Clean target in pcbuild.proj, and now the files in the Python\deepfreeze and Python\frozen_modules directories can be removed correctly by executing clean.bat.

I'm not sure if this is the best solution, please correct me if I'm wrong :)

Copy link
Member

I think this solution is great, and thanks for working it into the proper places in the build.

Do we need a backport of this? If so, is it needed in 3.10? (I think the frozen modules were only added in 3.11, right?) Either way, I wouldn't want to put it into 3.11.0 at this late stage, so it can wait until 3.11.1.

Sep 23, 2022
…iles for frozen modules (GH-96423)

(cherry picked from commit 3e26de3)

Co-authored-by: Charlie Zhao <[email protected]>
@kumaraditya303
Copy link
Contributor

Fixed by #96423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

8 participants