8000 Fix linkage problems with python3's versioned library (reintroduce `I… · kivy/python-for-android@efcb66f · GitHub
[go: up one dir, main page]

Skip to content

Commit efcb66f

Browse files
committed
Fix linkage problems with python3's versioned library (reintroduce INSTSONAME)
We fix this issue by re-introducing `INSTSONAME`. This variable has been used in all our python recipes, because allow us to remove the version of the compiled python library which is mandatory, at the time of writing, because android does not support versioned libraries (the Java method called to load the libraries only supports a .so suffix). A little history, because I didn't find any official documentation for this variable, and **it's quite important for us**: - This variable it's not hacked, it's official and was introduced a long time ago, forms part of the python's shared library building process (python/cpython@1142de3) - @tito introduced this variable almost at the beginning of the p4a project in (bdefea1) - @inclement also make use of it when he reworked the python2 recipe (4c8b5bc) - this variable still exists in the current python2 recipe and we make use of it precisely to solve the mentioned android's libraries version problem - Somehow, during the process of making the new python3 recipe, we loose this variable and then, we begin to have linkage problems at runtime with our python library as described in issue #1501 Note: ¡¡¡Special thanks to @Jonast!!!...to force me to search this information ;) References: python/cpython@1142de3, bdefea1 and 4c8b5bc Resolves: #1501
1 parent 8493d5e commit efcb66f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pythonforandroid/recipes/python3/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def build_arch(self, arch):
169169
exec_prefix=sys_exec_prefix)).split(' '), _env=env)
170170

171171
if not exists('python'):
172-
shprint(sh.make, 'all', _env=env)
172+
py_version = self.major_minor_version_string
173+
if self.major_minor_version_string[0] == '3':
174+
py_version += 'm'
175+
shprint(sh.make, 'all',
176+
'INSTSONAME=libpython{version}.so'.format(
177+
version=py_version),
178+
_env=env)
173179

174180
# TODO: Look into passing the path to pyconfig.h in a
175181
# better way, although this is probably acceptable
@@ -224,10 +230,6 @@ def create_python_bundle(self, dirn, arch):
224230
join(python_build_dir,
225231
'libpython{}m.so'.format(self.major_minor_version_string)),
226232
'libs/{}'.format(arch.arch))
227-
shprint(sh.cp,
228-
join(python_build_dir,
229-
'libpython{}m.so.1.0'.format(self.major_minor_version_string)),
230-
'libs/{}'.format(arch.arch))
231233

232234
info('Renaming .so files to reflect cross-compile')
233235
self.reduce_object_file_names(join(dirn, 'site-packages'))

0 commit comments

Comments
 (0)
0