Author christian.heimes
Recipients christian.heimes, eric.snow, gvanrossum
Date 2021-11-25.11:25:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637839501.04.0.0823297326226.issue45886@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-11-25 11:25:01christian.heimessetrecipients: + christian.heimes, gvanrossum, eric.snow
2021-11-25 11:25:01christian.heimessetmessageid: <1637839501.04.0.0823297326226.issue45886@roundup.psfhosted.org>
2021-11-25 11:25:01christian.heimeslinkissue45886 messages
2021-11-25 11:25:00christian.heimescreate