0

I'm trying to compile an apk using buildozer and kivy.

I have configure: error: C compiler cannot create executables error when I want to convert my kivy file to apk android file with buildozer android debug deploy.

Here is the complete error:

  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1297, in <module>
    main()
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 730, in __init__
    getattr(self, command)(args)
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 153, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 215, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 505, in build_recipes
    recipe.build_arch(arch)
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 34, in build_arch
    '--enable-shared', _env=env)
  File "/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/elmantr/.local/lib/python3.6/site-packages/sh.py", line 915, in next
    self.wait()
  File "/home/elmantr/.local/lib/python3.6/site-packages/sh.py", line 845, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/elmantr/.local/lib/python3.6/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_77: 

  RAN: /media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_21/libffi/configure --host=aarch64-linux-android --prefix=/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_21/libffi --disable-builddir --enable-shared

  STDOUT:
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-android
checking target system type... aarch64-unknown-linux-android
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-android-strip... /home/elmantr/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --strip-unneeded
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make -j4 sets $(MAKE)... yes
checking whether make -j4 supports nested variables... yes
checking for aarch64-linux-android-gcc... /home/elmantr/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC
checking whether the C compiler works... no
configure: error: in `/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/arm64-v8a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details


  STDERR:

# Command failed: ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=elmanapp', '--bootstrap=sdl2', '--requirements=python3,kivy', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     CLUTTER_IM_MODULE = 'xim'
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
#     LC_MEASUREMENT = 'az_IR'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     LC_PAPER = 'az_IR'
#     LC_MONETARY = 'az_IR'
#     XDG_MENU_PREFIX = 'gnome-'
#     LANG = 'en_US.UTF-8'
#     MANAGERPID = '2713'
#     DISPLAY = ':0'
#     INVOCATION_ID = '730eb555b32c458694066550940adc12'
#     GNOME_SHELL_SESSION_MODE = 'ubuntu'
#     COLORTERM = 'truecolor'
#     USERNAME = 'elmantr'
#     XDG_VTNR = '2'
#     SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
#     LC_NAME = 'az_IR'
#     XDG_SESSION_ID = '2'
#     USER = 'elmantr'
#     DESKTOP_SESSION = 'ubuntu'
#     QT4_IM_MODULE = 'xim'
#     TEXTDOMAINDIR = '/usr/share/locale/'
#     GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/e5623443_face_4b77_b607_cf5202805f3b'
#     PWD = '/media/elmantr/8C7CA79C7CA77F96/programming/python/kivy'
#     HOME = '/home/elmantr'
#     JOURNAL_STREAM = '9:38945'
#     TEXTDOMAIN = 'im-config'
#     SSH_AGENT_PID = '2853'
#     QT_ACCESSIBILITY = '1'
#     XDG_SESSION_TYPE = 'x11'
#     XDG_DATA_DIRS = '/usr/share/ubuntu:/home/elmantr/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
#     XDG_SESSION_DESKTOP = 'ubuntu'
#     LC_ADDRESS = 'az_IR'
#     DBUS_STARTER_ADDRESS = 'unix:path=/run/user/1000/bus,guid=eefa6fc1f5cb65c532b63f7e634033a7'
#     LC_NUMERIC = 'az_IR'
#     GTK_MODULES = 'gail:atk-bridge'
#     WINDOWPATH = '2'
#     TERM = 'xterm-256color'
#     VTE_VERSION = '5202'
#     SHELL = '/bin/bash'
#     QT_IM_MODULE = 'ibus'
#     XMODIFIERS = '@im=ibus'
#     IM_CONFIG_PHASE = '2'
#     DBUS_STARTER_BUS_TYPE = 'session'
#     XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
#     GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
#     GNOME_TERMINAL_SERVICE = ':1.124'
#     SHLVL = '1'
#     XDG_SEAT = 'seat0'
#     LC_TELEPHONE = 'az_IR'
#     GDMSESSION = 'ubuntu'
#     GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
#     LOGNAME = 'elmantr'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus,guid=eefa6fc1f5cb65c532b63f7e634033a7'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     XAUTHORITY = '/run/user/1000/gdm/Xauthority'
#     XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
#     PATH = '/home/elmantr/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/elmantr/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
#     LC_IDENTIFICATION = 'az_IR'
#     SESSION_MANAGER = 'local/elmantr:@/tmp/.ICE-unix/2749,unix/elmantr:/tmp/.ICE-unix/2749'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     GTK_IM_MODULE = 'ibus'
#     LC_TIME = 'az_IR'
#     _ = '/usr/local/bin/buildozer'
#     PACKAGES_PATH = '/home/elmantr/.buildozer/android/packages'
#     ANDROIDSDK = '/home/elmantr/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/elmantr/.buildozer/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '21'
# 
# 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

How can I solve the problem?

I have read these similar questions and they did not help:

buildozer - C compiler cannot create executables

configure: error: C compiler cannot create executables while compiling python for android ON Linux Ubuntu

buildozer android debug: c compiler error - cannot create executables - configure: exit77

configure: error: C compiler cannot create executables - Buildozer kivy to android debuging

Note: My operating system is 64-bit!

starball
  • 20,030
  • 7
  • 43
  • 238
Elman Shokri
  • 11
  • 1
  • 2

1 Answers1

1

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

If I run the command that failed in the terminal everything works fine, because my system use a different compiler outside of buildozer. If I am correct, you are using Ubuntu-Gnome, so this fix may not be interesting or relevant to you:

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

Maybe you have enough knowledge in linux or someone else can explain what happend after updating wsl1 to wsl2 so you can transfer the fix for your current system.

Chimono
  • 21
  • 2