This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: deepfreeze opaquely fails on Windows when building from Visual Studio
Type: compile error Stage: resolved
Components: Build, Windows Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, christian.heimes, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-12-04 09:47 by Dennis Sweeney, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
reproducer.txt Dennis Sweeney, 2021-12-04 09:47
Messages (6)
msg407648 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-12-04 09:47
I'd love to know if there is something I'm doing wrong, but with recent deepfreeze changes, my Visual Studio 2019 setup has been having trouble build things. It seems PCBuild/build.bat works perfectly and all tests pass and everything, but using the GUI in Visual Studio 2019 to build with the "Local Windows Debugger" green play button leads to a build failure. It gives the following output:

Build started...
1>------ Build started: Project: _freeze_module, Configuration: Debug x64 ------
1>_freeze_module.vcxproj -> C:\Users\sween\Source\Repos\temp\cpython\PCbuild\amd64\_freeze_module_d.exe
1>C:\Users\sween\Source\Repos\temp\cpython\PCbuild\_freeze_module.vcxproj(413,5): error MSB3073: The command " "C:\Users\sween\Source\Repos\temp\cpython\Tools\scripts\deepfreeze.py" "C:\Users\sween\Source\Repos\temp\cpython\Python\frozen_modules\importlib._bootstrap.h" "-m" "importlib._bootstrap" -o "C:\Users\sween\Source\Repos\temp\cpython\PCbuild\obj\311amd64_Debug\_freeze_module\importlib._bootstrap.g.h"" exited with code 103.
1>Done building project "_freeze_module.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

I wonder if it has something to do with how .py files are set to open? (shouldn't that be made not to matter?)

Attached are my more detailed steps to reproduce the failure.
msg407650 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-12-04 09:54
I think I've been getting similar issues for a little while that I've been able to work around until now. If I git checkout 3.10 and then hit the "Local Windows Debugger" button, I get this:

Build started...
1>------ Build started: Project: pythoncore, Configuration: Debug x64 ------
1>Killing any running python_d.exe instances...
1>Regenerate opcode.h opcode_targets.h
1>C:\Users\sween\Source\Repos\temp\cpython\PCbuild\regen.targets(62,5): error MSB3073: The command " Tools\scripts\generate_opcode_h.py Lib\opcode.py Include\opcode.h" exited with code 103.
1>Done building project "pythoncore.vcxproj" -- FAILED.
2>------ Build started: Project: _ctypes, Configuration: Debug x64 ------
3>------ Build started: Project: python, Configuration: Debug x64 ------
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

However, if I then run .\PCbuild\build.bat, and then hit the "Local Windows Debugger" button, the build succeeds.

Is there some difference in which python executable is chosen to run .py files between build.bat versus what Visual Studio does?
msg407653 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-12-04 10:18
Sure enough, if I go to "Choose Default Apps by File Type" in Windows settings and associate ".py" --> "Notepad", then Visual studio keeps opening Notepad windows during build.

Can the Visual Studio build configurations be made to run python scripts as "SOME_SPECIFIC_PYTHON_EXECUTABLE ./script.py" or perhaps "py ./script.py" instead of just "./script.py"?
msg407656 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-12-04 10:41
Actually, it seems $(PythonForBuild) is already used everywhere, it's just that $(PythonForBuild) is giving the empty string when VS uses it.

On the other hand, PCBuild/build.bat sets $(PythonForBuild) by calling out to find_python.bat, and that works great.

So perhaps the VS build should just be made to invoke find_python.bat.
msg407660 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-12-04 11:33
Main requires a recent version of Python in order to bootstrap the build process. I just re-introduced _bootstrap_python for configure & make builds in bpo-45950. Could somebody with a Windows system re-add _bootstrap_python to Windows build process? bpo-45850 and bpo-45873 have more context.
msg408874 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2021-12-18 22:40
This was fixed by https://github.com/python/cpython/pull/30143
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90136
2021-12-18 22:40:14Dennis Sweeneysetstatus: open -> closed
resolution: fixed
messages: + msg408874

stage: resolved
2021-12-04 11:33:45christian.heimessetnosy: + christian.heimes
messages: + msg407660
2021-12-04 10:41:31Dennis Sweeneysetmessages: + msg407656
2021-12-04 10:18:40Dennis Sweeneysetmessages: + msg407653
2021-12-04 09:54:05Dennis Sweeneysetmessages: + msg407650
2021-12-04 09:47:09Dennis Sweeneycreate