Skip to content

Commit 99ee28b

Browse files
committed
Fix linkage problems with python's versioned library
The Java method called to load the libraries only supports a .so suffix, so we must remove the version for our python libraries, or we will get linkage errors Resolves: #1501
1 parent bdd2b7c commit 99ee28b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pythonforandroid/python.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,12 @@ def build_arch(self, arch):
231231
_env=env)
232232

233233
if not exists('python'):
234-
shprint(sh.make, 'all', _env=env)
234+
py_version = self.major_minor_version_string
235+
if self.major_minor_version_string[0] == '3':
236+
py_version += 'm'
237+
shprint(sh.make, 'all',
238+
'INSTSONAME=libpython{version}.so'.format(
239+
version=py_version), _env=env)
235240

236241
# TODO: Look into passing the path to pyconfig.h in a
237242
# better way, although this is probably acceptable
@@ -291,9 +296,8 @@ def create_python_bundle(self, dirn, arch):
291296
python_lib_name = 'libpython' + self.major_minor_version_string
292297
if self.major_minor_version_string[0] == '3':
293298
python_lib_name += 'm'
294-
for lib in [python_lib_name + '.so', python_lib_name + '.so.1.0']:
295-
shprint(sh.cp, join(python_build_dir, lib),
296-
'libs/{}'.format(arch.arch))
299+
shprint(sh.cp, join(python_build_dir, python_lib_name + '.so'),
300+
'libs/{}'.format(arch.arch))
297301

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

0 commit comments

Comments
 (0)