cannot open input file '.obj' in build on distutils from Python 3.9
See original GitHub issueWe are currently building binary wheels for Windows under Python 3.7 and 3.8. When attempting to add Python 3.9 to the mix - in both cibuildwheel and directly in a Windows python 3.9 venv - quotes are being omitted around the link call.
I originally reported it in cibuildwheel here - https://github.com/joerick/cibuildwheel/issues/441
Quoting that here: I’m attempting to build wheels on python 3.7, 3.8, and now 3.9.
With recent changes in setuptools a couple of weeks ago I was forced to add:
CIBW_ENVIRONMENT_WINDOWS: SETUPTOOLS_USE_DISTUTILS=stdlib
To have the Windows MSVC build for 3.8 correctly put quotes around LIBPATH entries in the link command line. This entry is showing it improperly unquoted:
/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\ATLMFC\lib\x64
Without the quotes it’s then trying to link from C:\Program Files\
instead of the actual lib directories.
My new attempt to build with python 3.9 gave me this new error:
C:\cibw\python\python.3.9.0-rc1\tools\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
at - https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true#step:13:1697
The unquoted Windows link attempt is here: https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true#step:13:1883
Overall run can be found here - https://github.com/Chia-Network/chiapos/runs/1221477218?check_suite_focus=true
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (10 by maintainers)
Top GitHub Comments
In a8f9d49, I’ve patched the culled repro and the error no longer occurs. Correct me if I’m wrong, but I suspect the use of
[""]
was intended to mean “no args” but in fact it means “one blank arg”, and now thatsubprocess.Popen
is correctly passing that empty arg to the subprocess, the linker is trying to link a file called./.obj
, which doesn’t exist. Given that the issue was unintended, incorrect usage, I doubt we’ll want to invest time and energy restoring the prior, less-correct behavior in distutils… thought it might make sense for the msvccompiler to error on or remove blank command args if that can be shown to never be valid.The rendering of the command-line turned out to be a red herring. It’s true that the distutils change did also affect the rendering of the command-line, but that was incidental and generally didn’t affect the behavior. I’ll make a patch to the distutls code to use
list2cmdline
when rendering the command line for logging to make it more correct.I’m going to close this as invalid, but please don’t hesitate to comment if making this change in chiapos doesn’t fix the issue.
Thanks for the assist! That’s working solidly and I’ll push it out to our other repos as well. We totally agree that bug for bug compatibility isn’t a good idea…