Skip to content

Commit

Permalink
Fix linkage problems with python's versioned library
Browse files Browse the repository at this point in the history
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
  • Loading branch information
opacam committed Jan 6, 2019
1 parent bdd2b7c commit 99ee28b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pythonforandroid/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ def build_arch(self, arch):
_env=env)

if not exists('python'):
shprint(sh.make, 'all', _env=env)
py_version = self.major_minor_version_string
if self.major_minor_version_string[0] == '3':
py_version += 'm'
shprint(sh.make, 'all',
'INSTSONAME=libpython{version}.so'.format(
version=py_version), _env=env)

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

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

0 comments on commit 99ee28b

Please sign in to comment.