Skip to content

Commit

Permalink
Fixes gevent recipe on arm64-v8a arch
Browse files Browse the repository at this point in the history
Adding `libm.so` to the `arm64-v8a` build fixes undefined reference
errors. The (truncated) config.log errors were:
```
...
libpython3.7m.so: undefined reference to `hypot@LIBC'
libpython3.7m.so: undefined reference to `frexp@LIBC'
libpython3.7m.so: undefined reference to `cos@LIBC'
libpython3.7m.so: undefined reference to `pow@LIBC'
libpython3.7m.so: undefined reference to `atan2@LIBC'
libpython3.7m.so: undefined reference to `modf@LIBC'
libpython3.7m.so: undefined reference to `exp@LIBC'
libpython3.7m.so: undefined reference to `sin@LIBC'
libpython3.7m.so: undefined reference to `log@LIBC'
libpython3.7m.so: undefined reference to `fmod@LIBC'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
...
```
Refs: kivy#1722 (comment)
  • Loading branch information
AndreMiras committed Mar 22, 2020
1 parent 22eb6c9 commit 7757f8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pythonforandroid/recipes/gevent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
"""
- Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment.
- Moves all -l<lib> from LDFLAGS to LIBS environment.
- Copies all -l<lib> from LDLIBS to LIBS environment.
- Fixes linker name (use cross compiler) and flags (appends LIBS)
"""
env = super(GeventRecipe, self).get_recipe_env(arch, with_flags_in_cc)
env = super().get_recipe_env(arch, with_flags_in_cc)
# CFLAGS may only be used to specify C compiler flags, for macro definitions use CPPFLAGS
regex = re.compile(r'(?:\s|^)-[DI][\S]+')
env['CPPFLAGS'] = ''.join(re.findall(regex, env['CFLAGS'])).strip()
Expand All @@ -24,6 +25,7 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
# LDFLAGS may only be used to specify linker flags, for libraries use LIBS
regex = re.compile(r'(?:\s|^)-l[\w\.]+')
env['LIBS'] = ''.join(re.findall(regex, env['LDFLAGS'])).strip()
env['LIBS'] += ' {}'.format(''.join(re.findall(regex, env['LDLIBS'])).strip())
env['LDFLAGS'] = re.sub(regex, '', env['LDFLAGS'])
info('Moved "{}" from LDFLAGS to LIBS.'.format(env['LIBS']))
return env
Expand Down

0 comments on commit 7757f8f

Please sign in to comment.