Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Commit 79e7d9c

Browse files
committed
Custom gevent recipe to fix broken arm64-v8a build
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/python-for-android#1722 (comment)
1 parent 8a06b5c commit 79e7d9c

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

src/etherollapp/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22

33

4+
## [Unreleased]
5+
6+
- Fix broken arm64-v8a build
7+
8+
49
## [v2020.0322]
510

611
- Support Infura API key, refs #170
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import re
2+
3+
from pythonforandroid.logger import info
4+
from pythonforandroid.recipe import CythonRecipe
5+
6+
7+
class GeventRecipe(CythonRecipe):
8+
version = '1.4.0'
9+
url = (
10+
'https://pypi.python.org/packages/source/g/gevent/'
11+
'gevent-{version}.tar.gz'
12+
)
13+
depends = ['librt', 'greenlet']
14+
patches = ["cross_compiling.patch"]
15+
16+
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
17+
"""
18+
- Moves all -I<inc> -D<macro> from CFLAGS to CPPFLAGS environment.
19+
- Moves all -l<lib> from LDFLAGS to LIBS environment.
20+
- Copies all -l<lib> from LDLIBS to LIBS environment.
21+
- Fixes linker name (use cross compiler) and flags (appends LIBS)
22+
"""
23+
env = super().get_recipe_env(arch, with_flags_in_cc)
24+
# CFLAGS may only be used to specify C compiler flags,
25+
# for macro definitions use CPPFLAGS
26+
regex = re.compile(r'(?:\s|^)-[DI][\S]+')
27+
env['CPPFLAGS'] = ''.join(re.findall(regex, env['CFLAGS'])).strip()
28+
env['CFLAGS'] = re.sub(regex, '', env['CFLAGS'])
29+
info('Moved "{}" from CFLAGS to CPPFLAGS.'.format(env['CPPFLAGS']))
30+
# LDFLAGS may only be used to specify linker flags,
31+
# for libraries use LIBS
32+
regex = re.compile(r'(?:\s|^)-l[\w\.]+')
33+
env['LIBS'] = ''.join(re.findall(regex, env['LDFLAGS'])).strip()
34+
env['LIBS'] += ' {}'.format(
35+
''.join(re.findall(regex, env['LDLIBS'])).strip())
36+
env['LDFLAGS'] = re.sub(regex, '', env['LDFLAGS'])
37+
info('Moved "{}" from LDFLAGS to LIBS.'.format(env['LIBS']))
38+
return env
39+
40+
41+
recipe = GeventRecipe()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/_setupares.py b/_setupares.py
2+
index dd184de6..bb16bebe 100644
3+
--- a/_setupares.py
4+
+++ b/_setupares.py
5+
@@ -43,7 +43,7 @@ else:
6+
ares_configure_command = ' '.join([
7+
"(cd ", quoted_dep_abspath('c-ares'),
8+
" && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ",
9+
- " && sh ./configure --disable-dependency-tracking " + _m32 + "CONFIG_COMMANDS= ",
10+
+ " && sh ./configure --host={} --disable-dependency-tracking ".format(os.environ['TOOLCHAIN_PREFIX']) + _m32 + "CONFIG_COMMANDS= ",
11+
" && cp ares_config.h ares_build.h \"$OLDPWD\" ",
12+
" && cat ares_build.h ",
13+
" && if [ -r ares_build.h.orig ]; then mv ares_build.h.orig ares_build.h; fi)",
14+
diff --git a/_setuplibev.py b/_setuplibev.py
15+
index 2a5841bf..b6433c94 100644
16+
--- a/_setuplibev.py
17+
+++ b/_setuplibev.py
18+
@@ -31,7 +31,7 @@ LIBEV_EMBED = should_embed('libev')
19+
# and the PyPy branch will clean it up.
20+
libev_configure_command = ' '.join([
21+
"(cd ", quoted_dep_abspath('libev'),
22+
- " && sh ./configure ",
23+
+ " && sh ./configure --host={} ".format(os.environ['TOOLCHAIN_PREFIX']),
24+
" && cp config.h \"$OLDPWD\"",
25+
")",
26+
'> configure-output.txt'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy