Skip to content

Proposal: Remove Obsolete biglink and liblink Code Path #3193

@dogancankalinci

Description

@dogancankalinci

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?)"
    )
  1. The biglink Path is Not Executed: The biglink() function is only called if ctx.python_recipe is None. However, all modern builds are initiated with a TargetPythonRecipe (like python3), which explicitly sets ctx.python_recipe. Therefore, the if condition is effectively always false, and the else block containing the warning is always executed.

  2. 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 the site-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.

  3. 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 without biglink. 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() and copylibs_function() in build.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions