Christian Heimes <li...@cheimes.de> added the comment:

The FREEZE_MODULE trick fails with out-of-tree builds when SRCDIR contains the 
frozen_modules header files from a previous build. When doing OOT building, 
make includes the SRCDIR in the search path for dependencies (VPATH). It 
considers $(srcdir)/Python/frozen_modules/importlib._bootstrap_external.h as 
recent enough and therefore does not generate 
$(builddir)/Python/frozen_modules/importlib._bootstrap_external.h. The 
freeze_module program does not know about VPATH and looks up the file in the 
$(builddir) tree:

$ make 
FREEZE_MODULE=/cpython/builddep/ubuntu-impish-x86_64/Programs/_freeze_module
...
python3.9 ../../Tools/scripts/deepfreeze.py 
Python/frozen_modules/importlib._bootstrap_external.h -m 
importlib._bootstrap_external -o 
Python/deepfreeze/importlib._bootstrap_external.c
Traceback (most recent call last):
  File "/cpython/builddep/wasi/../../Tools/scripts/deepfreeze.py", line 463, in 
<module>
    main()
  File "/cpython/builddep/wasi/../../Tools/scripts/deepfreeze.py", line 451, in 
main
    with open(args.file, encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 
'Python/frozen_modules/importlib._bootstrap_external.h'
make: *** [Makefile:1055: Python/deepfreeze/importlib._bootstrap_external.c] 
Error 1

$ make 
FREEZE_MODULE=/cpython/builddep/ubuntu-impish-x86_64/Programs/_freeze_module 
Python/frozen_modules/importlib._bootstrap_external.h  
make: '../../Python/frozen_modules/importlib._bootstrap_external.h' is up to 
date.


I see two possible solutions for the problem:

* extend ``make clean`` to also remove $(FROZEN_FILES_OUT). The make clean 
command is suppose to remove all files that interferes with OOT builds (see 
check-clean-src in Makefile.pre.in).
* prefix $(FROZEN_FILES_OUT) and their targets with $(abs_builddir) to avoid 
VPATH lookups. abs_builddir is the absolute path to the build directory.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45886>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to