aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-05-27 16:57:06 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-05-31 14:21:52 +0200
commitfbc74b20cfd011bdb6bc5e3ceeb3fc94c659bd9f (patch)
tree8d21588ad9bea063e38f1b56b215cb8078557417
parent8b4a49fd738e08b221098e66c41ea9ab9cbfd46a (diff)
Android Cross Compilation: Add INSTSONAME
- Remove the use of patchelf to set the SONAME of the libpython shared library. This can be done during the build process of CPython for Android by setting the INSTSONAME variable in the Makefile. - In addition, remove the redundant parameters passed to make install. Pick-to: 6.7 Task-number: PYSIDE-1612 Change-Id: Ia18a1480a676abb89ed1afa3250f3745fffedbdd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--tools/cross_compile_android/main.py10
-rw-r--r--tools/cross_compile_android/templates/cross_compile.tmpl.sh6
2 files changed, 5 insertions, 11 deletions
diff --git a/tools/cross_compile_android/main.py b/tools/cross_compile_android/main.py
index bda438cca..a1cc82876 100644
--- a/tools/cross_compile_android/main.py
+++ b/tools/cross_compile_android/main.py
@@ -221,7 +221,8 @@ if __name__ == "__main__":
ndk_path=ndk_path,
api_level=platform_data.api_level,
android_py_install_path_prefix=pyside6_deploy_cache,
- host_python_path=sys.executable
+ host_python_path=sys.executable,
+ python_version=PYTHON_VERSION
)
logging.info(f"Writing Python cross compile script into {python_ccompile_script}")
@@ -240,13 +241,6 @@ if __name__ == "__main__":
run_command([f"./{python_ccompile_script.name}"], cwd=cpython_dir, dry_run=dry_run,
show_stdout=True)
- # run patchelf to change the SONAME of libpython from libpython3.x.so.1.0 to
- # libpython3.x.so, to match with python_for_android's Python library. Otherwise,
- # the Qfp binaries won't be able to link to Python
- run_command(["patchelf", "--set-soname", f"libpython{PYTHON_VERSION}.so",
- f"libpython{PYTHON_VERSION}.so.1.0"], cwd=Path(python_path) / "lib",
- dry_run=dry_run)
-
logging.info(
f"Cross compile Python for Android platform {platform_data.plat_name}. "
f"Final installation in {python_path}"
diff --git a/tools/cross_compile_android/templates/cross_compile.tmpl.sh b/tools/cross_compile_android/templates/cross_compile.tmpl.sh
index a68907591..6c17e077c 100644
--- a/tools/cross_compile_android/templates/cross_compile.tmpl.sh
+++ b/tools/cross_compile_android/templates/cross_compile.tmpl.sh
@@ -24,6 +24,6 @@ export CFLAGS='-fPIC -DANDROID'
--with-build-python={{ host_python_path }} --enable-shared \
--enable-ipv6 ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no --without-ensurepip \
ac_cv_little_endian_double=yes
-make BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- CROSS_COMPILE_TARGET=yes
-make install BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- \
-CROSS_COMPILE_TARGET=yes prefix={{ android_py_install_path_prefix }}/Python-$HOST_ARCH/_install
+make BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- CROSS_COMPILE_TARGET=yes \
+INSTSONAME=libpython{{ python_version }}.so
+make install prefix={{ android_py_install_path_prefix }}/Python-$HOST_ARCH/_install