Repository: kivy/python-for-android

Issue:
Python3 + greenlet install issue
This is with Ubuntu 16.04 and crystax-ndk-10.3.2.
```
buildozer android debug
# Check configuration tokens
Truncating the trace...
[INFO]:    Building python3crystax for armeabi-v7a
[INFO]:    Building greenlet for armeabi-v7a
[INFO]:    greenlet apparently isn't already in site-packages
[INFO]:    Installing greenlet into site-packages
[INFO]:    -> directory context /home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/other_builds/greenlet-python3crystax/armeabi-v7a/greenlet
[INFO]:    -> running python3.5 setup.py install -O2 --root=/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.
           working: /usr/include/python3.Exception in thread background thread for pid 10406:                                                                                                              
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1:                                                                                                                                                                                  [19/275]

  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.

  STDOUT:
running install
running build
running build_ext
building 'greenlet' extension
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.bui
ldozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -DNDEBUG -g -fwrapv -O2 -Wall
 -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10
.3.2/platforms/android-19/arch-arm -I/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthum
b -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c greenlet.c -o build/temp.linux-x86_64-3.5/greenlet.o
In file included from /usr/include/python3.5m/Python.h:8:0,
                 from greenlet.h:8,
                 from greenlet.c:5:
/usr/include/python3.5m/pyconfig.h:15:53: fatal error: arm-linux-gnueabi/python3.5m/pyconfig.h: No such file or directory
compilation terminated.
error: command '/usr/bin/ccache' failed with exit status 1


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 573, in build_recipes
  File "pythonforandroid/recipe.py", line 775, in build_arch
  File "pythonforandroid/recipe.py", line 797, in install_python_package
  File "pythonforandroid/logger.py", line 175, in shprint
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/andre/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.

  STDOUT:
running install
running build
running build_ext
building 'greenlet' extension
/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.bui
ldozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -DNDEBUG -g -fwrapv -O2 -Wall
 -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10
.3.2/platforms/android-19/arch-arm -I/home/andre/workspace/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthum
b -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c greenlet.c -o build/temp.linux-x86_64-3.5/greenlet.o
In file included from /usr/include/python3.5m/Python.h:8:0,
                 from greenlet.h:8,
                 from greenlet.c:5:
/usr/include/python3.5m/pyconfig.h:15:53: fatal error: arm-linux-gnueabi/python3.5m/pyconfig.h: No such file or directory
compilation terminated.
error: command '/usr/bin/ccache' failed with exit status 1


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=etheroll --bootstrap=sdl2 --requirements=hostpython3crystax,python3crystax,android,kivy,gevent,https://gitlab.com/kivymd/
KivyMD/repository/archive.zip?ref=19e587e6,devp2p==0.9.3,https://github.com/ethereum/pyethapp/archive/8406f32.zip,web3==4.0.0b11,https://github.com/corpetty/py-etherscan-api/archive/a783f720a6175b227cdfe8
dc3040ebad3022d79f.zip,eth-testrpc==1.3.3 --arch armeabi-v7a --copy-libs --local-recipes /home/andre/workspace/EtherollApp/src/python-for-android/recipes --color=always --storage-dir=/home/andre/workspace
/EtherollApp/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
```

On Gentoo a bit different, but related, since it's trying to hook with the wrong include and get types mismatch at pre-processing type:
```
buildozer android debug
...
[INFO]:    Building python3crystax for armeabi-v7a                                                    
[INFO]:    Building greenlet for armeabi-v7a
[INFO]:    greenlet apparently isn't already in site-packages
[INFO]:    Installing greenlet into site-packages
[INFO]:    -> directory context /home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/other_builds/greenlet-python3crystax/armeabi-v7a/greenlet     
[INFO]:    -> running python3.5 setup.py install -O2 --root=/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.
           working:  #error "LONG_BIT definition appears wrong for plaException in thread background thread for pid 5781: (bad gcc/glibc config?)."
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()   
  File "/usr/lib64/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)                                                                                                                                                                                                                             File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 2170, in background_thread                                                                                                                                                                          
    handle_exit_code(exit_code)                                                                                                                                                                                                                                              File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 1929, in fn 
    return self.command.handle_command_exit_code(exit_code) 
  File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc                      
ErrorReturnCode_1:                                                                                                             
                                                                                 
  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.
                                                                    
  STDOUT:
running install
running build
running build_ext
building 'greenlet' extension                                                                                                                                                                                                                                              arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm
-isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
 -I/usr/include/python3.5m -c greenlet.c -o build/temp.linux-x86_64-3.5/greenlet.o
In file included from /usr/include/python3.5m/Python.h:50:0,
                 from greenlet.h:8,                 
                 from greenlet.c:5:      
/usr/include/python3.5m/pyport.h:820:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:


Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 573, in build_recipes
  File "pythonforandroid/recipe.py", line 775, in build_arch
  File "pythonforandroid/recipe.py", line 797, in install_python_package
  File "pythonforandroid/logger.py", line 175, in shprint
  File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/andre/.local/lib64/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1:

  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.

  STDOUT:
running install
running build
running build_ext
building 'greenlet' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.5 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/usr/include/python3.5m -c greenlet.c -o build/temp.linux-x86_64-3.5/greenlet.o
In file included from /usr/include/python3.5m/Python.h:50:0,
                 from greenlet.h:8,
                 from greenlet.c:5:
/usr/include/python3.5m/pyport.h:820:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:

# Command failed: /usr/bin/python2.7 -m pythonforandroid.toolchain create --dist_name=etheroll --bootstrap=sdl2 --requirements=python3crystax,kivy,gevent,https://gitlab.com/kivymd/KivyMD/repository/archive.zip?ref=19e587e6,devp2p==0.9.3,https://github.com/ethereum/pyethapp/archive/8406f32.zip,web3==4.0.0b11,https://github.com/corpetty/py-etherscan-api/archive/a783f720a6175b227cdfe8dc3040ebad3022d79f.zip,eth-testrpc==1.3.3 --arch armeabi-v7a --copy-libs --local-recipes /home/andre/Progz/EtherollApp/src/python-for-android/recipes --color=always --storage-dir=/home/andre/Progz/EtherollApp/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
```


Relevant parts of my buildozer.spec (requirements and ndk_path):
```
requirements =
    hostpython3crystax,
    python3crystax,
    kivy,
    gevent
android.ndk_path = ~/.buildozer/crystax-ndk
```

For this error my guess is the greenlet recipe should be updated to to override CFLAGS and other  things.


Discussion:
Don't mean to hijack the issue, but I'm running into a very similar trace for `python3crystax`+`cffi`:

<details>
 <summary>trace</summary>

```
[INFO]:    Building cffi for armeabi-v7a
[INFO]:    cffi apparently isn't already in site-packages
[INFO]:    Building compiled components in cffi
[INFO]:    -> directory context /home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a/libffi
[INFO]:    <- directory context /opt/python-for-android
[INFO]:    -> directory context /home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/cffi-python3crystax/armeabi-v7a/cffi
[INFO]:    -> running python3.6 setup.py clean --all
[INFO]:    -> running python3.6 setup.py build_ext -v
Exception in thread background thread for pid 14432:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/python3.6 setup.py build_ext -v

  STDOUT:
running build_ext
building '_cffi_backend' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/c
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/python-installs/Electrum/include/python3.6 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/python-installs/Electrum/include/python3.6 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a/libffi/arm-unknown-linux-androideabi/include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.6/c/_cffi_backend.o
In file included from /usr/include/python3.6m/Python.h:8:0,
                 from c/_cffi_backend.c:2:
/usr/include/python3.6m/pyconfig.h:15:53: fatal error: arm-linux-gnueabi/python3.6m/pyconfig.h: No such file or directory
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/python-for-android/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/opt/python-for-android/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/opt/python-for-android/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/opt/python-for-android/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/opt/python-for-android/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/opt/python-for-android/pythonforandroid/build.py", line 574, in build_recipes
    recipe.build_arch(arch)
  File "/opt/python-for-android/pythonforandroid/recipe.py", line 843, in build_arch
    self.build_compiled_components(arch)
  File "/opt/python-for-android/pythonforandroid/recipe.py", line 855, in build_compiled_components
    _env=env, *self.setup_extra_args)
  File "/opt/python-for-android/pythonforandroid/logger.py", line 175, in shprint
    for line in output:
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.5/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/python3.6 setup.py build_ext -v

  STDOUT:
running build_ext
building '_cffi_backend' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/c
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/python-installs/Electrum/include/python3.6 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/python-installs/Electrum/include/python3.6 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a/libffi/arm-unknown-linux-androideabi/include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.6/c/_cffi_backend.o
In file included from /usr/include/python3.6m/Python.h:8:0,
                 from c/_cffi_backend.c:2:
/usr/include/python3.6m/pyconfig.h:15:53: fatal error: arm-linux-gnueabi/python3.6m/pyconfig.h: No such file or directory
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:

b'\x1b[0m\r           working: running build                                                            'b'\x1b[0m\r           working: running build_py                                                         'b'\x1b[0m\r           working: copying jnius_config.py -> build/lib.linux-x86_64-3.6                    'b'\x1b[0m\r           working: copying jnius/__init__.py -> build/lib.linux-x86_64-3.6/jnius            'b'\x1b[0m\r           working: copying jnius/signatures.py -> build/lib.linux-x86_64-3.6/jnius          'b'\x1b[0m\r           working: copying jnius/reflect.py -> build/lib.linux-x86_64-3.6/jnius             'b'\x1b[0m\r           working: creating build/lib.linux-x86_64-3.6/jnius/src                            'b'\x1b[0m\r           working: creating build/lib.linux-x86_64-3.6/jnius/src/org                        'b'\x1b[0m\r           working: creating build/lib.linux-x86_64-3.6/jnius/src/org/jnius                  'b'\x1b[0m\r           working: copying jnius/src/org/jnius/NativeInvocationHandler.jav...(and 51 more)  'b'\x1b[0m\r           working: running build_ext                                                        'b"\x1b[0m\r           working: skipping 'jnius/jnius.c' Cython extension (up-to-date)                   "b'\x1b[0m\r           working: running install_lib                                                      'b'\x1b[0m\r           working: creating /home/user/wspace/electrum/.buildozer/android/...(and 51 more)  'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius/__init__.py ->...(and 100 more) 'b'\x1b[0m\r           working: creating /home/user/wspace/electrum/.buildozer/android/...(and 55 more)  'b'\x1b[0m\r           working: creating /home/user/wspace/electrum/.buildozer/android/...(and 59 more)  'b'\x1b[0m\r           working: creating /home/user/wspace/electrum/.buildozer/android/...(and 65 more)  'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius/src/org/jnius/...(and 145 more) 'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius/signatures.py ...(and 102 more) 'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius/jnius.cpython-...(and 126 more) 'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius/reflect.py -> ...(and 99 more)  'b'\x1b[0m\r           working: copying build/lib.linux-x86_64-3.6/jnius_config.py -> /...(and 92 more)  'b'\x1b[0m\r           working: byte-compiling /home/user/wspace/electrum/.buildozer/an...(and 98 more)  'b'\x1b[0m\r           working: byte-compiling /home/user/wspace/electrum/.buildozer/an...(and 102 more) 'b'\x1b[0m\r           working: byte-compiling /home/user/wspace/electrum/.buildozer/an...(and 96 more)  'b'\x1b[0m\r           working: byte-compiling /home/user/wspace/electrum/.buildozer/an...(and 100 more) 'b"\x1b[0m\r           working: writing byte-compilation script '/tmp/tmpllx2_6ag.py'                    "b'\x1b[0m\r           working: /usr/bin/python3.6 /tmp/tmpllx2_6ag.py                                   'b'\x1b[0m\r           working: removing /tmp/tmpllx2_6ag.py                                             'b'\x1b[0m\r           working: running install_egg_info                                                 'b'\x1b[0m\r           working: running egg_info                                                         'b'\x1b[0m\r           working: creating pyjnius.egg-info                                                'b'\x1b[0m\r           working: writing pyjnius.egg-info/PKG-INFO                                        'b'\x1b[0m\r           working: writing dependency_links to pyjnius.egg-info/dependency_links.txt        'b'\x1b[0m\r           working: writing requirements to pyjnius.egg-info/requires.txt                    'b'\x1b[0m\r           working: writing top-level names to pyjnius.egg-info/top_level.txt                'b"\x1b[0m\r           working: writing manifest file 'pyjnius.egg-info/SOURCES.txt'                     "b"\x1b[0m\r           working: reading manifest file 'pyjnius.egg-info/SOURCES.txt'                     "b"\x1b[0m\r           working: reading manifest template 'MANIFEST.in'                                  "b"\x1b[0m\r           working: writing manifest file 'pyjnius.egg-info/SOURCES.txt'                     "b'\x1b[0m\r           working: Copying pyjnius.egg-info to /home/user/wspace/electrum/...(and 94 more)  'b'\x1b[0m\r           working: running install_scripts                                                  'b'\x1b[0m\r                                                                                             \r'b'\x1b[0m\r           working: running clean                                                            'b"\x1b[0m\r           working: 'build/lib.linux-x86_64-3.6' does not exist -- can't clean it            "b"\x1b[0m\r           working: 'build/bdist.linux-x86_64' does not exist -- can't clean it              "b"\x1b[0m\r           working: 'build/scripts-3.6' does not exist -- can't clean it                     "b'\x1b[0m\r                                                                                             \r'b'\x1b[0m\r           working: running build_ext                                                        'b"\x1b[0m\r           working: building '_cffi_backend' extension                                       "b'\x1b[0m\r           working: creating build                                                           \x1b[0m\r           working: creating build/temp.linux-x86_64-3.6                                     'b'\x1b[0m\r           working: creating build/temp.linux-x86_64-3.6/c                                   \x1b[0m\r           working: arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-f...(and 955 more)  'b'\x1b[0m\r           working: In file included from /usr/include/python3.6m/Python.h:8:0,              \x1b[0m\r           working:                  from c/_cffi_backend.c:2:                               'b'\x1b[0m\r           working: /usr/include/python3.6m/pyconfig.h:15:53: fatal error: ...(and 66 more)  'b'\x1b[0m\r           working: compilation terminated.                                                  'b"\x1b[0m\r           working: error: command 'arm-linux-androideabi-gcc' failed with exit status 1     "b'\x1b[0m\r                                                                                             \r'# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=Electrum --bootstrap=sdl2 --requirements=python3crystax==3.6,android,openssl,plyer,kivy==master,cffi --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/user/wspace/electrum/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
```
</details>
@SomberNight Give it a try with Python3.5 instead of Python3.6. Also it looks a bit similar, but I can tell it's probably not that related. I may have some ideas what it is, but please create a dedicated issue for it and paste the link here.
Edit: pull request ready https://github.com/kivy/python-for-android/pull/1250

Resolving patch:
diff --git a/pythonforandroid/recipes/greenlet/__init__.py b/pythonforandroid/recipes/greenlet/__init__.py
--- a/pythonforandroid/recipes/greenlet/__init__.py
+++ b/pythonforandroid/recipes/greenlet/__init__.py
@@ -1,10 +1,11 @@
-from pythonforandroid.recipe import PythonRecipe
+from pythonforandroid.recipe import CompiledComponentsPythonRecipe
 
 
-class GreenletRecipe(PythonRecipe):
-    version = '0.4.9'
+class GreenletRecipe(CompiledComponentsPythonRecipe):
+    version = '0.4.15'
     url = 'https://pypi.python.org/packages/source/g/greenlet/greenlet-{version}.tar.gz'
-    depends = [('python2', 'python3crystax')]
+    depends = ['setuptools']
+    call_hostpython_via_targetpython = False
 
 
 recipe = GreenletRecipe()


Test patch: