[New-bugs-announce] [issue34389] CPython may fail to build in the presence of a ~/.pydistutils.cfg
Antony Lee
report at bugs.python.org
Sun Aug 12 15:32:17 EDT 2018
New submission from Antony Lee <anntzer.lee at gmail.com>:
I have a ~/.pydistutils.cfg with the following contents:
[build_ext]
force = true
inplace = true
(--force is useful because sometimes just comparing timestamps is insufficient to know whether a package needs to be rebuilt, e.g. in the presence of external dependencies -- and I use ccache anyways to avoid paying for excessive rebuilds; --inplace is useful as I have quite a few packages with extension modules that are editably-installed).
With this ~/.pydistutils.cfg, cpython fails to build. For example, having checked out v3.7.0 from a git clone (otherwise clean git repo, per `git clean -xfd`),
mkdir build && cd build && ../configure && make
ultimately results in
<elided>
gcc -pthread -shared build/temp.linux-x86_64-3.7/home/antony/src/extern/cpython/Modules/_ctypes/_ctypes.o build/temp.linux-x86_64-3.7/home/antony/src/extern/cpython/Modules/_ctypes/callbacks.o build/temp.linux-x86_64-3.7/home/antony/src/extern/cpython/Modules/_ctypes/callproc.o build/temp.linux-x86_64-3.7/home/antony/src/extern/cpython/Modules/_ctypes/stgdict.o build/temp.linux-x86_64-3.7/home/antony/src/extern/cpython/Modules/_ctypes/cfield.o -L/usr/local/lib -lffi -ldl -o /home/antony/src/extern/cpython/build/_ctypes.cpython-37m-x86_64-linux-gnu.so
*** WARNING: renaming "_struct" since importing it failed: build/lib.linux-x86_64-3.7/_struct.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "../setup.py", line 442, in check_extension_import
importlib._bootstrap._load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
File "<frozen importlib._bootstrap>", line 583, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1043, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: build/lib.linux-x86_64-3.7/_struct.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../setup.py", line 2363, in <module>
main()
File "../setup.py", line 2358, in main
"Tools/scripts/2to3", "Tools/scripts/pyvenv"]
File "/home/antony/src/extern/cpython/Lib/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/antony/src/extern/cpython/Lib/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/antony/src/extern/cpython/Lib/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/antony/src/extern/cpython/Lib/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/antony/src/extern/cpython/Lib/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/antony/src/extern/cpython/Lib/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/antony/src/extern/cpython/Lib/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "../setup.py", line 308, in build_extensions
self.check_extension_import(ext)
File "../setup.py", line 447, in check_extension_import
assert not self.inplace
AssertionError
make: *** [Makefile:618: sharedmods] Error 1
Removing the ~/.pydistutils.cfg fixes the issue and leads to a successful build.
I think(?) CPython's build system should essentially make sure that distutils behaves as if `--no-user-cfg` was in effect. Or at least the limitation should be documented, but it's not very practical to have to temporarily rename an existing ~/.pydistutils.cfg whenever building CPython. See also https://bugs.python.org/issue9309, perhaps.
----------
components: Build
messages: 323452
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: CPython may fail to build in the presence of a ~/.pydistutils.cfg
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34389>
_______________________________________
More information about the New-bugs-announce
mailing list