-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Summary
This issue proposes the complete removal of the biglink
and liblink
functionality from the python-for-android codebase. This build path appears to be a legacy mechanism that is no longer used in any standard build involving a Python recipe (e.g., python3
), making it effectively dead code. Its removal would simplify the toolchain, reduce maintenance overhead, and improve clarity for new contributors.
Reasoning
The primary evidence for the obsolescence of biglink
is in pythonforandroid/build.py
:
# 4) biglink everything
info_main('# Biglinking object files')
if not ctx.python_recipe:
biglink(ctx, arch)
else:
warning(
"Context's python recipe found, "
"skipping biglink (will this work?)"
)
-
The
biglink
Path is Not Executed: Thebiglink()
function is only called ifctx.python_recipe
isNone
. However, all modern builds are initiated with aTargetPythonRecipe
(likepython3
), which explicitly setsctx.python_recipe
. Therefore, theif
condition is effectively always false, and theelse
block containing the warning is always executed. -
The Modern Build Process Works Differently: The current, functional build process does not rely on combining all compiled components into a single
libpymodules.so
. Instead, it leverages the standard Python ecosystem approach where each compiled extension (e.g., from Cython or C) is built into its own.so
file and placed in thesite-packages
directory. The Python interpreter on Android then loads these modules using the standard import mechanism, which is more robust, modular, and aligns with how Python packages are handled on other platforms. -
The
(will this work?)
Comment: The warning"skipping biglink (will this work?)"
is a historical artifact from when the build system was transitioning to the modern approach. Years of successful builds have definitively answered this question: Yes, it works withoutbiglink
. The modern method is the de facto standard, and the comment itself, while once a valid question, is now a source of confusion.
Benefits of Removal
- Code Simplification: Removing this legacy path will eliminate a significant amount of complex and now-unnecessary code, including the
biglink()
andcopylibs_function()
inbuild.py
and the liblink and biglink tools in tools/. - Reduced Maintenance Burden: Eliminates the need to maintain or debug a code path that is no longer in use.
- Improved Clarity for Contributors: New developers will no longer be confused by this obsolete build logic or the historical warning message. This makes the build process easier to understand and contribute to.
This change would be a valuable cleanup, making the python-for-android build system leaner and more aligned with its current, functional architecture. Open to discussion on any potential edge cases where this legacy code might still be triggered, although none are apparent in the standard workflow.