GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — gh-111225: Link extension modules against libpython on Android by mhsmith · Pull Request #115780 · python/cpython Conversation
|
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the back and forth; I had forgotten to clean the build folder. I redid my tests and I now can confirm that this breaks --enable-shared builds on macOS (main works fine).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Aha, this PR does not include 074bbec; rebasing onto |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ython#115780) Part of the work on PEP 738: Adding Android as a supported platform. * Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately reflect its purpose. * Edit makesetup to use MODULE_LDFLAGS when linking extension modules. * Edit the Makefile so that extension modules depend on libpython on Android and Cygwin. * Restore `-fPIC` on Android. It was removed several years ago with a note that the toolchain used it automatically, but this is no longer the case. Omitting it causes all linker commands to fail with an error like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol '_Py_FalseStruct'; recompile with -fPIC`.
Follow on to python#115780 . Without this change numpy's build is broken.
Follow on to python#115780 . Without this change numpy's build is broken.
…ython#115780) Part of the work on PEP 738: Adding Android as a supported platform. * Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately reflect its purpose. * Edit makesetup to use MODULE_LDFLAGS when linking extension modules. * Edit the Makefile so that extension modules depend on libpython on Android and Cygwin. * Restore `-fPIC` on Android. It was removed several years ago with a note that the toolchain used it automatically, but this is no longer the case. Omitting it causes all linker commands to fail with an error like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol '_Py_FalseStruct'; recompile with -fPIC`.
Renaming it breaks the de-facto API that the sysconfig module has provided for 5 years, and which downstream projects rely on.
That check was originally written to configure the python-config script -- I later updated it to also configure the python.pc file. distutils had its own, second copy of the configure.ac logic which was probably dropped during the migration away from internally using distutils. Not really the fault of the variable itself but what can you do. :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It's unfortunate that sysconfig exposes all the Makefile variables in this way, because most of them were created with no intention of becoming a stable API. Can you give some examples of projects that rely on this variable? Setuptools, at least, does not rely on it. It has its own logic for deciding which platforms need to link against libpython, and it already knows about Windows, Cygwin and Android. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Lacking any formalization of the information which might come via #107956, it is necessary to poke at raw Makefile variables -- in this case, the raw Makefile variable that corresponds to whether the "C-API extension modules" pkg-config file is configured to link to libpython. The setuptools logic is actually a copy-paste of the stdlib distutils logic, which was manually kept in sync with Makefile.pre.in up until it got deleted from the stdlib. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This looks like it's going to break the build for NumPy on Android - the flag to link to
I couldn't agree more, but unfortunately that's the situation we're in. It's best not to rename variables unless the actual content/semantics of the variable changes. In this case, reverting the rename looks like the right thing to do. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for the explanation.
Actually as @eli-schwartz says in #116745 (comment), it looks like it will break the build on every platform except Android, because the Meson code defaults to linking against libpython when the variable is missing from sysconfig. So I agree the rename must be reverted. I've done that in #122764. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for looking into this! :) Fingers crossed that PEP 739 can be rolled out in the near future (hopefully as a beautiful gift included in 3.14). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
mhsmith:android-link-modules |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ython#115780) Part of the work on PEP 738: Adding Android as a supported platform. * Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately reflect its purpose. * Edit makesetup to use MODULE_LDFLAGS when linking extension modules. * Edit the Makefile so that extension modules depend on libpython on Android and Cygwin. * Restore `-fPIC` on Android. It was removed several years ago with a note that the toolchain used it automatically, but this is no longer the case. Omitting it causes all linker commands to fail with an error like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol '_Py_FalseStruct'; recompile with -fPIC`.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Cross Compile for Android and issues with PyExc_OSError
There was an error while loading. Please reload this page.