Skip to content

Commit

Permalink
Fixed libzqm recipe linking issues (#1803)
Browse files Browse the repository at this point in the history
* fixed crtbegin_so.o crtend_so.o link errors adding sysroot compiler option
* updated ZMQ library version from github releases
* a little fixes on env vars
* added method for include directories
* fixed conversion to bytes on config str write
* fixed concatenation string issue changed to format directive
  • Loading branch information
hpsaturn authored and AndreMiras committed Apr 25, 2019
1 parent 12aa76c commit e4cecb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions pythonforandroid/recipes/libzmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


class LibZMQRecipe(Recipe):
version = '4.1.4'
url = 'http://download.zeromq.org/zeromq-{version}.tar.gz'
version = '4.3.1'
url = 'https://github.com/zeromq/libzmq/releases/download/v{version}/zeromq-{version}.zip'
depends = []

def should_build(self, arch):
Expand All @@ -31,14 +31,14 @@ def build_arch(self, arch):
bash = sh.Command('sh')
shprint(
bash, './configure',
'--host=arm-linux-androideabi',
'--host={}'.format(arch.command_prefix),
'--without-documentation',
'--prefix={}'.format(prefix),
'--with-libsodium=no',
_env=env)
shprint(sh.make, _env=env)
shprint(sh.make, 'install', _env=env)
shutil.copyfile('.libs/libzmq.so', join(
shutil.copyfile('src/.libs/libzmq.so', join(
self.ctx.get_libs_dir(arch.arch), 'libzmq.so'))

bootstrap_obj_dir = join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch)
Expand All @@ -55,6 +55,9 @@ def build_arch(self, arch):
self.ctx.get_libs_dir(arch.arch)
)

def get_include_dirs(self, arch):
return [join(self.get_build_dir(arch.arch), 'include')]

def get_recipe_env(self, arch):
# XXX should stl be configuration for the toolchain itself?
env = super(LibZMQRecipe, self).get_recipe_env(arch)
Expand All @@ -69,6 +72,8 @@ def get_recipe_env(self, arch):
env['CXXFLAGS'] += ' -lgnustl_shared'
env['LDFLAGS'] += ' -L{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}'.format(
self.ctx.ndk_dir, self.ctx.toolchain_version, arch)
env['CXXFLAGS'] += ' --sysroot={}/platforms/android-{}/arch-arm'.format(
self.ctx.ndk_dir, self.ctx.ndk_api)
return env


Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/pyzmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def build_cython_components(self, arch):
[global]
zmq_prefix = {}
skip_check_zmq = True
""".format(libzmq_prefix))
""".format(libzmq_prefix).encode())

return super(PyZMQRecipe, self).build_cython_components(arch)

Expand Down

0 comments on commit e4cecb1

Please sign in to comment.