Repository navigation
Windows build fails with error C2039 in deepfreeze.c #94781
Copy link
Copy link
Closed
Labels
Description
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
Reactions are currently unavailable
Activity
[-]Windows build fails with[/-][+]Windows build fails with error C2039 in deepfreeze.c[/+]arhadthedev commentedon Jul 12, 2022
Does the problem disappear after deletion of
Python\deepfreeze\*andPython\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 commentedon 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.batshould delete those files? I'd tried that expecting it to reset everything, and was surprised when it didn't work.Fidget-Spinner commentedon Jul 12, 2022
@kumaraditya303
git clean -fdXas a workaround and that worked for me. However, I agree thatclean.batshould do something about those files.zware commentedon Aug 31, 2022
Rather than adding cleanup logic to
clean.batdirectly, can theCleantarget of the project file that creates the files in question be taught how to clean them up?clean.batis itself intentionally very bare-bones.CharlieZhao95 commentedon Aug 31, 2022
The build still fails after executing the
clean.batwhich is unexpected result, and the reason for the failure is indeed that some files were not deleted correctly.For users, executing
clean.batfirst 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.batwill negatively affect the build process either. Maybe we coud do both.zware commentedon Aug 31, 2022
My point is that
clean.batitself is the wrong place to add cleanup logic. I agree that the act of callingclean.batshould 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 whichclean.batinvokes.CharlieZhao95 commentedon Sep 1, 2022
Thanks for your detailed reply. I may have misinterpreted your previous message.
I will learn about the clean target in MSbuild later :)
CharlieZhao95 commentedon Sep 7, 2022
#96423 I modified the
Cleantarget inpcbuild.proj, and now the files in thePython\deepfreezeandPython\frozen_modulesdirectories can be removed correctly by executingclean.bat.I'm not sure if this is the best solution, please correct me if I'm wrong :)
pythongh-94781: Fix Windows projects not cleaning intermediate and ou…
gh-94781: Fix Windows projects not cleaning intermediate and output f…
zooba commentedon Sep 7, 2022
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.
gh-94781: Fix Windows projects not cleaning intermediate and output f…
kumaraditya303 commentedon Sep 30, 2022
Fixed by #96423