
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-09-10 19:02 byEdSchouten, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| patch-freeze-importlib | EdSchouten,2016-09-10 19:02 | Patch to make cross compilation work | review | |
| patch-freeze-importlib | EdSchouten,2016-09-11 06:25 | Revised patch: make sure that _freeze_importlib writes to the right location | review | |
| srcdir-check.patch | martin.panter,2016-09-11 09:24 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg275674 -(view) | Author: Ed Schouten (EdSchouten)* | Date: 2016-09-10 19:02 | |
For CloudABI (https://mail.python.org/pipermail/python-dev/2016-July/145708.html) we're providing packages containing a precompiled copy of Python. As we had to make some changes to importlib (namely to deal with directory file descriptors), we have to do a rebuild of importlib.h during the cross compilation process, usingPrograms/_freeze_importlib.We've run into a couple of issues that require us to patch up the build system to make this work:- First of all,Programs/_freeze_importlib is built using the compiler for the target. There is no way to override this. The OpenWRT folks have also run into this issue and have patched up the Makefile to add a $FREEZE_IMPORTLIB that allows you to use a different executable:https://github.com/openwrt/packages/blob/master/lang/python3/patches/013-make-freeze-import-lib-into-an-override-able-var.patchThis patch is almost correct; it doesn't prevent _freeze_importlib from being built, which is needed in our case as it doesn't build cleanly on CloudABI.- Second, if an out-of-tree build is performed, we need to make sure thatPython/frozen.c imports the right copy of importlib.h. We must add -IPython to the compiler flags to realise.Attached is a patch that contains the modifications that we've made to Makefile.pre.in to make cross compilation work for us. | |||
| msg275712 -(view) | Author: Martin Panter (martin.panter)*![]() | Date: 2016-09-10 23:21 | |
Can you get your importlib changes so they are compatible with a native build? If so, maybe you can build the frozen module with a native build rather than a cross build.“freeze_importlib is built using the compiler for the target”: I may be mistaken, but I thought we recently prevented this from being cross-compiled:Issue 27641, revisionbc677cb34889, Jul 2016. Your patch seems to be based ontop of this change. Perhaps you have found some way to bypass that cross-compilation detection logic.The addition of $(FREEZE_IMPORTLIB) is a bit like the outdated cross-override.patch I once proposed forIssue 22625. | |||
| msg275735 -(view) | Author: Ed Schouten (EdSchouten)* | Date: 2016-09-11 06:25 | |
The nice thing is that in our case, the importlib changes are already compatible with the native build. So yes, we can reuse the frozen module from the native build. :-)Ah, yes.Issue 27641 already prevents that it's cross compiled. This patch was written prior to that and simply rebased.Still, one problem remains: our strategy for creating importlib.h and importlib_external.h doesn't take out-of-tree builds into account. Even if we regenerate it, frozen.c won't pick it up because its directory is not part of the compiler search path.Attached is a patch that makes us write the results of _freeze_importlib into $(srcdir)/Python/importlib*.h instead, so that even with an out-of-tree build, we actually update the header files used by frozen.c. | |||
| msg275754 -(view) | Author: Martin Panter (martin.panter)*![]() | Date: 2016-09-11 09:20 | |
There are various tricky cases to be considered with the regenerated files like importlib.h. One of them is that you are supposed to be able to build Python from a read-only source tree. SeeIssue 15819. Writing files into $(srcdir) would break this.Also, as I just wrote in that bug, the builtPython/importlib.h is already supposed to be searchable. However the logic seems to be broken. Can you see if this patch helps? | |||
| msg275799 -(view) | Author: Ed Schouten (EdSchouten)* | Date: 2016-09-11 14:27 | |
It does. I can now cross build Python for CloudABI by copying importlib.h and importlib_external.h from the native build directory to the target build directory. Thanks! | |||
| msg275911 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-09-12 01:56 | |
New changesetc26dce72a4da by Martin Panter in branch '3.5':Issue#28066: Fix include search directory logic for out-of-tree buildshttps://hg.python.org/cpython/rev/c26dce72a4daNew changeset3ef078f96494 by Martin Panter in branch 'default':Issue#28066: Merge srcdir fix from 3.5https://hg.python.org/cpython/rev/3ef078f96494 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:36 | admin | set | github: 72253 |
| 2016-09-12 03:35:03 | martin.panter | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: + Python 3.5, Python 3.6, - Python 3.7 |
| 2016-09-12 01:56:30 | python-dev | set | nosy: +python-dev messages: +msg275911 |
| 2016-09-11 14:27:12 | EdSchouten | set | messages: +msg275799 |
| 2016-09-11 09:24:14 | martin.panter | set | files: +srcdir-check.patch |
| 2016-09-11 09:22:07 | martin.panter | set | files: -srcdir-check.patch |
| 2016-09-11 09:20:46 | martin.panter | set | files: +srcdir-check.patch messages: +msg275754 stage: patch review |
| 2016-09-11 09:08:20 | martin.panter | link | issue15819 dependencies |
| 2016-09-11 07:56:58 | serhiy.storchaka | set | keywords: +patch |
| 2016-09-11 06:25:05 | EdSchouten | set | files: +patch-freeze-importlib messages: +msg275735 |
| 2016-09-10 23:21:01 | martin.panter | set | nosy: +martin.panter messages: +msg275712 |
| 2016-09-10 19:02:01 | EdSchouten | create | |