Buildozer fails to compile libffi on arm64/aarch64 CPU

2.1k views Asked by At

I am Trying to run Buildozer on my Android Phone. For this i am using Arch Linux pRoot on Termux App (Android 7)(redmi Note 4)

Since Google Only distributes x86_64 version of NDK, i am using aarch64/arm64 Android NDK (version r21d) and SDK from this GitHub Repo : https://github.com/Lzhiyong/termux-ndk

And i am using JDK 15 from arch Linux arm repositories.

For testing purposes i am using a simple hello world script, print("Hello")

When i Run buildozer -v android debug, everything goes fine first, it Downloads stuff and then tries to compile it. Everything else compiles successfully except libffi.

What I Have Tried So far :-

  1. I tried compiling for both armeabi-v7a and arm64-v8a, both failed.
  2. I tried installing libffi via pacman, no effect.
  3. I tried Creating Github issue, no reply.
  4. I tried to ask on stack overflow, received lot of downvotes saying all logs and code should be pasted in question not on external website, deleted old question.

Here is my buildozer.spec File :-

[app]

# (str) Title of your application
title = My Application

# (str) Package name
package.name = myapp

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,ui

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests,bin,.buildozer,__pycache__

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version = 0.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3==3.8.7

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1

#
# Android specific
#

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1

# (string) Presplash background color (for new android toolchain)
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
# olive, purple, silver, teal.
android.presplash_color = cyan

# (list) Permissions
#android.permissions = INTERNET

# (int) Target Android API, should be as high as possible.
android.api = 30

# (int) Minimum API your APK will support.
android.minapi = 23

# (int) Android SDK version to use
#android.sdk = 20

# (str) Android NDK version to use
android.ndk = r21d

# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
android.ndk_api = 23

# (bool) Use --private data storage (True) or --dir public storage (False)
android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = ~/Android_Tools/android-ndk-r21d

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path = ~/Android_Tools/android-sdk

# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
android.skip_update = True

# (bool) If True, then automatically accept SDK license
# agreements. This is intended for automation only. If set to False,
# the default, you will be shown the license when first running
# buildozer.
android.accept_sdk_license = True

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (str) Android app theme, default is ok for Kivy-based app
# android.apptheme = "@android:style/Theme.NoTitleBar"

# (list) Pattern to whitelist for the whole project
#android.whitelist =

# (str) Path to a custom whitelist file
#android.whitelist_src =

# (str) Path to a custom blacklist file
#android.blacklist_src =

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (list) Android AAR archives to add (currently works only with sdl2_gradle
# bootstrap)
#android.add_aars =

# (list) Gradle dependencies to add (currently works only with sdl2_gradle
# bootstrap)
#android.gradle_dependencies =

# (list) add java compile options
# this can for example be necessary when importing certain java libraries using the 'android.gradle_dependencies' option
# see https://developer.android.com/studio/write/java8-support for further information
# android.add_compile_options = "sourceCompatibility = 1.8", "targetCompatibility = 1.8"

# (list) Gradle repositories to add {can be necessary for some android.gradle_dependencies}
# please enclose in double quotes 
# e.g. android.gradle_repositories = "maven { url 'https://kotlin.bintray.com/ktor' }"
#android.add_gradle_repositories =

# (list) packaging options to add 
# see https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
# can be necessary to solve conflicts in gradle_dependencies
# please enclose in double quotes 
# e.g. android.add_packaging_options = "exclude 'META-INF/common.kotlin_module'", "exclude 'META-INF/*.kotlin_module'"
#android.add_gradle_repositories =

# (list) Java classes to add as activities to the manifest.
#android.add_activities = com.example.ExampleActivity

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard

# (list) Android additional libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_arm64_v8a = libs/android-v8/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

# (list) Android shared libraries which will be added to AndroidManifest.xml using <uses-library> tag
#android.uses_library =

# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D

# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1

# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = arm64-v8a,armeabi-v7a

# (int) overrides automatic versionCode computation (used in build.gradle)
# this is not the same as app version and should only be edited if you know what you're doing
# android.numeric_version = 1


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 0

# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin

I am getting Following Error when libffi compilation fails :-

[INFO]:    Building libffi for armeabi-v7a
[INFO]:    -> directory context /root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi
[INFO]:    -> running autoreconf -vif
[INFO]:    -> running configure --host=arm-linux-androidea...(and 163 more)
           working: See `config.log' for more details                                Exception in thread background thread for pid 14933:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.9/site-packages/sh.py", line 1637, in wrap
    fn(*rgs, **kwargs)
  File "/usr/lib/python3.9/site-packages/sh.py", line 2561, in background_thread
    handle_exit_code(exit_code)
  File "/usr/lib/python3.9/site-packages/sh.py", line 2265, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.9/site-packages/sh.py", line 865, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_77:

  RAN: /root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared

  STDOUT:
checking build system type... aarch64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make -j8 sets $(MAKE)... yes
checking whether make -j8 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details


  STDERR:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
    main()
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
    getattr(self, command)(args)
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 154, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 213, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx,
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 577, in build_recipes
    recipe.build_arch(arch)
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 42, in build_arch
    shprint(sh.Command('./configure'),
  File "/root/test/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/usr/lib/python3.9/site-packages/sh.py", line 911, in next
    self.wait()
  File "/usr/lib/python3.9/site-packages/sh.py", line 841, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.9/site-packages/sh.py", line 865, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_77:

  RAN: /root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared

  STDOUT:
checking build system type... aarch64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make -j8 sets $(MAKE)... yes
checking whether make -j8 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/root/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3 --arch armeabi-v7a --copy-libs --color=always --storage-dir="/root/test/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21

Here is the config.log :-

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libffi configure 3.3-rc0, which was
generated by GNU Autoconf 2.70.  Invocation command line was

  $ /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/configure --host=aarch64-linux-android --prefix=/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi --disable-builddir --enable-shared

## --------- ##
## Platform. ##
## --------- ##

hostname = localhost
uname -m = aarch64
uname -r = 3.18.31-perf-g040a88f
uname -s = Linux
uname -v = #1 SMP PREEMPT Thu Nov 7 00:28:25 WIB 2019

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/
PATH: /root/Android_Tools/android-ndk-r21d/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86/bin/
PATH: /root/Android_Tools/android-ndk-r21d/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/
PATH: /root/Android_Tools/android-ndk-r21d/
PATH: /root/Android_Tools/android-sdk/tools/
PATH: /root/.buildozer/android/platform/apache-ant-1.9.4/bin/
PATH: /root/bin/
PATH: /usr/local/sbin/
PATH: /usr/local/bin/
PATH: /usr/bin/
PATH: /usr/lib/jvm/default/bin/
PATH: /usr/bin/site_perl/
PATH: /usr/bin/vendor_perl/
PATH: /usr/bin/core_perl/
PATH: /usr/sbin/
PATH: /sbin/
PATH: /bin/


## ----------- ##
## Core tests. ##
## ----------- ##

configure:3064: looking for aux files: ltmain.sh compile missing install-sh config.guess config.sub
configure:3077:  trying ./
configure:3106:   ./ltmain.sh found
configure:3106:   ./compile found
configure:3106:   ./missing found
configure:3088:   ./install-sh found
configure:3106:   ./config.guess found
configure:3106:   ./config.sub found
configure:3227: checking build system type
configure:3242: result: aarch64-unknown-linux-gnu
configure:3262: checking host system type
configure:3276: result: aarch64-unknown-linux-android
configure:3296: checking target system type
configure:3310: result: aarch64-unknown-linux-android
configure:3409: checking for gsed
configure:3445: result: sed
configure:3474: checking for a BSD-compatible install
configure:3547: result: /usr/bin/install -c
configure:3558: checking whether build environment is sane
configure:3613: result: yes
configure:3670: checking for aarch64-linux-android-strip
configure:3702: result: aarch64-linux-android-strip --strip-unneeded
configure:3773: checking for a race-free mkdir -p
configure:3817: result: /usr/bin/mkdir -p
configure:3824: checking for gawk
configure:3845: found /usr/bin/gawk
configure:3856: result: gawk
configure:3867: checking whether make -j8 sets $(MAKE)
configure:3890: result: yes
configure:3920: checking whether make -j8 supports nested variables
configure:3938: result: yes
configure:4088: checking for aarch64-linux-android-gcc
configure:4120: result: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a
configure:4518: checking for C compiler version
configure:4527: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a --version >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4538: $? = 1
configure:4527: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -v >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4538: $? = 1
configure:4527: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -V >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4538: $? = 1
configure:4527: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -qversion >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4538: $? = 1
configure:4527: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -version >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4538: $? = 1
configure:4558: checking whether the C compiler works
configure:4580: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a -DANDROID -D__ANDROID_API__=23 -I/root/Android_Tools/android-ndk-r21d/sysroot/usr/include/aarch64-linux-android -I/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/python-installs/myapp/include/python3.8   -L/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/libs_collections/myapp/arm64-v8a conftest.c  >&5
WARNING: linker: /root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang.real: unsupported flags DT_FLAGS_1=0x8000001
configure:4584: $? = 1
configure:4624: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libffi"
| #define PACKAGE_TARNAME "libffi"
| #define PACKAGE_VERSION "3.3-rc0"
| #define PACKAGE_STRING "libffi 3.3-rc0"
| #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
| #define PACKAGE_URL ""
| #define PACKAGE "libffi"
| #define VERSION "3.3-rc0"
| /* end confdefs.h.  */
| 
| int
| main (void)
| {
| 
|   ;
|   return 0;
| }
configure:4629: error: in `/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi':
configure:4631: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=aarch64-unknown-linux-gnu
ac_cv_env_CCASFLAGS_set=
ac_cv_env_CCASFLAGS_value=
ac_cv_env_CCAS_set=
ac_cv_env_CCAS_value=
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-DANDROID -D__ANDROID_API__=23 -I/root/Android_Tools/android-ndk-r21d/sysroot/usr/include/aarch64-linux-android -I/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/python-installs/myapp/include/python3.8'
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=aarch64-linux-android
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=aarch64-unknown-linux-android
ac_cv_path_ax_enable_builddir_sed=sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/usr/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CC='/root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a'
ac_cv_prog_STRIP='aarch64-linux-android-strip --strip-unneeded'
ac_cv_prog_make_make_set=yes
ac_cv_target=aarch64-unknown-linux-android
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/missing aclocal-1.16'
ALLOCA=''
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_LTLDFLAGS=''
AM_RUNTESTFLAGS=''
AM_V='$(V)'
AR='aarch64-linux-android-ar'
AUTOCONF='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/missing autoconf'
AUTOHEADER='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/missing autoheader'
AUTOMAKE='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/missing automake-1.16'
AWK='gawk'
BUILD_DOCS_FALSE=''
BUILD_DOCS_TRUE=''
CC='/root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a'
CCAS=''
CCASDEPMODE=''
CCASFLAGS=''
CCDEPMODE=''
CFLAGS='-target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a'
CPPFLAGS='-DANDROID -D__ANDROID_API__=23 -I/root/Android_Tools/android-ndk-r21d/sysroot/usr/include/aarch64-linux-android -I/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/python-installs/myapp/include/python3.8'
CXX='/root/Android_Tools/android-ndk-r21d/toolchains/llvm/prebuilt/linux-aarch64/bin/clang++ -target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a'
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS='-target aarch64-linux-android23 -fomit-frame-pointer -march=armv8-a'
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FFI_DEBUG_FALSE=''
FFI_DEBUG_TRUE=''
FFI_EXEC_TRAMPOLINE_TABLE=''
FFI_EXEC_TRAMPOLINE_TABLE_FALSE=''
FFI_EXEC_TRAMPOLINE_TABLE_TRUE=''
FGREP=''
GREP=''
HAVE_LONG_DOUBLE=''
HAVE_LONG_DOUBLE_VARIANT=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD='aarch64-linux-android-ld'
LDFLAGS='  -L/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/libs_collections/myapp/arm64-v8a'
LIBFFI_BUILD_VERSIONED_SHLIB_FALSE=''
LIBFFI_BUILD_VERSIONED_SHLIB_GNU_FALSE=''
LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE=''
LIBFFI_BUILD_VERSIONED_SHLIB_SUN_FALSE=''
LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE=''
LIBFFI_BUILD_VERSIONED_SHLIB_TRUE=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/usr/bin/mkdir -p'
NM='aarch64-linux-android-nm'
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OPT_LDFLAGS=''
OTOOL64=''
OTOOL=''
PACKAGE='libffi'
PACKAGE_BUGREPORT='http://github.com/libffi/libffi/issues'
PACKAGE_NAME='libffi'
PACKAGE_STRING='libffi 3.3-rc0'
PACKAGE_TARNAME='libffi'
PACKAGE_URL=''
PACKAGE_VERSION='3.3-rc0'
PATH_SEPARATOR=':'
PRTDIAG=''
RANLIB='aarch64-linux-android-ranlib'
SECTION_LDFLAGS=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP='aarch64-linux-android-strip --strip-unneeded'
TARGET='aarch64-unknown-linux-android'
TARGETDIR=''
TARGET_OBJ=''
TESTSUBDIR_FALSE=''
TESTSUBDIR_TRUE=''
VERSION='3.3-rc0'
ac_ct_AR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCCAS_FALSE=''
am__fastdepCCAS_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
ax_enable_builddir_sed='sed'
bindir='${exec_prefix}/bin'
build='aarch64-unknown-linux-gnu'
build_alias=''
build_cpu='aarch64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='aarch64-unknown-linux-android'
host_alias='aarch64-linux-android'
host_cpu='aarch64'
host_os='linux-android'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/root/test/.buildozer/android/platform/build-arm64-v8a,armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_23/libffi'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sys_symbol_underscore=''
sysconfdir='${prefix}/etc'
target='aarch64-unknown-linux-android'
target_alias='aarch64-linux-android'
target_cpu='aarch64'
target_os='linux-android'
target_vendor='unknown'
toolexecdir=''
toolexeclibdir=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "libffi"
#define PACKAGE_TARNAME "libffi"
#define PACKAGE_VERSION "3.3-rc0"
#define PACKAGE_STRING "libffi 3.3-rc0"
#define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
#define PACKAGE_URL ""
#define PACKAGE "libffi"
#define VERSION "3.3-rc0"

configure: exit 77

Any Help ?

3

There are 3 answers

1
Eternal Frustation On

Did you try to get the latest clang compiler? Seems like there is no working c compiler on your installation of arch on termux. If you do have a c compiler working, you may try to get the base-devel package and make an alias for the c compiler as gcc

0
Chimono On

I had the exact same issue with windows (ubuntu subsystem 20.4.1), NDK r25b, android api 31, sdk 21, p4a develop.

I could solve this error by manualy updating wsl1 to wsl2.

1
Lozminda On

I too had this error.

After many hours looking at config files and other logs, I found what got me past the 'unable to build libffi' errors was tweaking my buildozer.spec, the android api versions within, and then re-running

buildozer -v android debug

Here's a the bit of the buildozer spec I'd changed:

# (int) Target Android API, should be as high as possible.
android.api = 28

# (int) Minimum API your APK / AAB will support.
android.minapi = 23

# (int) Android SDK version to use
android.sdk = 23

# (str) Android NDK version to use
android.ndk = 23

# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
android.ndk_api = 23

(Having every version, that isn't the max version, the same seems to help as well.)

As an educated guess as to why this works: buildozer is downloading slightly different packages,build instructions and config files, depending on which ADK is specified and there just happens to be the correct tools/PATHS etc for building libffi in the versions I've specified.

These versions are not what I'm trying to build for, but I've had to alter my goals, after 2 weeks of wrestling with this software, to:-

Just building the simplest 'hello world' for any version of android that might work. I figure if I can get something built I'll target more later.

In summary: Now libffi does compile after adjusting android API versions in the buildozer spec; I have new errors but libffi is now compiled.

I'm runnning Linux Mate 19.1 on a 64bit machine