Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libffi - configure: error: C compiler cannot create executables (WSL 2) #2953

Closed
Source61 opened this issue Jan 17, 2024 · 2 comments
Closed
Labels

Comments

@Source61
Copy link

  • Python: 3.10.12
  • OS: Ubuntu 22.04.3 LTS
  • Kivy: 2.3.0
  • Cython: 3.0.8
  • OpenJDK: 21

Description

Trying to compile a test Python3 application for android.
NDK version r25c (r25b is no longer available), I've also tried newer versions. r24 is no longer supported.
API version: 32. I've also tried both older and newer versions than this.

buildozer.spec

Command:

p4a apk --private . --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy --arch=armeabi-v7a

Spec file:

Logs

[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 32
[INFO]:    Available Android APIs are (27, 30, 32, 34)
[INFO]:    Requested API target 32 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/john/Documents/android-ndk-r25c
[INFO]:    Found NDK version 25c
[INFO]:    Found Android API target in $NDKAPI
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found a single valid recipe set: ['hostpython3', 'libffi', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    The selected bootstrap is sdl2
[INFO]:    # Creating dist with sdl2 bootstrap
[INFO]:    Dist will have name unnamed_dist_22 and requirements (python3, kivy)
[INFO]:    Dist contains the following requirements as recipes: ['hostpython3', 'libffi', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    Dist will also contain modules (chardet, certifi, idna, requests, urllib3) installed from pip
[INFO]:    Dist will be build in mode debug
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/bootstrap_builds/sdl2
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Recipe build order is ['hostpython3', 'libffi', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    The requirements (certifi, chardet, idna, requests, urllib3) were not found as recipes, they will be installed with pip.
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython3
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/hostpython3
[INFO]:    �[90m->�[0m running basename https://www.python.org/ftp/python/3.1...(and 23 more)
[INFO]:    hostpython3 download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading libffi
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/libffi
[INFO]:    �[90m->�[0m running basename https://github.com/libffi/libffi/archive/v3.4.2.tar.gz
[INFO]:    libffi download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading openssl
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/openssl
[INFO]:    �[90m->�[0m running basename https://www.openssl.org/source/openssl-1.1.1m.tar.gz
[INFO]:    openssl download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading sdl2_image
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/sdl2_image
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_im...(and 59 more)
[INFO]:    sdl2_image download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading sdl2_mixer
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/sdl2_mixer
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_mi...(and 59 more)
[INFO]:    sdl2_mixer download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading sdl2_ttf
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/sdl2_ttf
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_tt...(and 57 more)
[INFO]:    sdl2_ttf download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading sqlite3
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/sqlite3
[INFO]:    �[90m->�[0m running basename https://www.sqlite.org/2021/sqlite-am...(and 22 more)
[INFO]:    sqlite3 download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading python3
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/python3
[INFO]:    �[90m->�[0m running basename https://www.python.org/ftp/python/3.1...(and 23 more)
[INFO]:    python3 download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading sdl2
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/sdl2
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL/re...(and 49 more)
[INFO]:    sdl2 download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading setuptools
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/setuptools
[INFO]:    �[90m->�[0m running basename https://pypi.python.org/packages/sou...(and 41 more)
[INFO]:    setuptools download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading six
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/six
[INFO]:    �[90m->�[0m running basename https://pypi.python.org/packages/sour...(and 26 more)
[INFO]:    six download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading pyjnius
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/pyjnius
[INFO]:    �[90m->�[0m running basename https://github.com/kivy/pyjnius/archive/1.5.0.zip
[INFO]:    pyjnius download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Downloading android
[INFO]:    Skipping android download as no URL is set
[INFO]:    Downloading kivy
[INFO]:    -> directory context /home/john/.local/share/python-for-android/packages/kivy
[INFO]:    �[90m->�[0m running basename https://github.com/kivy/kivy/archive/2.2.1.zip
[INFO]:    kivy download already cached, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython3 for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://www.python.org/ftp/python/3.1...(and 23 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/hostpython3/desktop
[INFO]:    hostpython3 is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking libffi for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/libffi/libffi/archive/v3.4.2.tar.gz
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25
[INFO]:    libffi is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking openssl for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://www.openssl.org/source/openssl-1.1.1m.tar.gz
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/openssl/armeabi-v7a__ndk_target_25
[INFO]:    openssl is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking sdl2_image for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_im...(and 59 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/bootstrap_builds/sdl2/jni
[INFO]:    sdl2_image is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking sdl2_mixer for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_mi...(and 59 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/bootstrap_builds/sdl2/jni
[INFO]:    sdl2_mixer is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking sdl2_ttf for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL_tt...(and 57 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/bootstrap_builds/sdl2/jni
[INFO]:    sdl2_ttf is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking sqlite3 for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://www.sqlite.org/2021/sqlite-am...(and 22 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/sqlite3/armeabi-v7a__ndk_target_25
[INFO]:    sqlite3 is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking python3 for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://www.python.org/ftp/python/3.1...(and 23 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/python3/armeabi-v7a__ndk_target_25
[INFO]:    python3 is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking sdl2 for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/libsdl-org/SDL/re...(and 49 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/bootstrap_builds/sdl2/jni
[INFO]:    sdl2 is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking setuptools for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://pypi.python.org/packages/sou...(and 41 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/setuptools/armeabi-v7a__ndk_target_25
[INFO]:    setuptools is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking six for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://pypi.python.org/packages/sour...(and 26 more)
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/six/armeabi-v7a__ndk_target_25
[INFO]:    six is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Unpacking pyjnius for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/kivy/pyjnius/archive/1.5.0.zip
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/pyjnius-sdl2/armeabi-v7a__ndk_target_25
[INFO]:    pyjnius is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    �[90m->�[0m running cp -a /home/john/.local/lib/python3.10/site-p...(and 154 more)
[INFO]:    Unpacking kivy for armeabi-v7a
[INFO]:    �[90m->�[0m running basename https://github.com/kivy/kivy/archive/2.2.1.zip
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/kivy/armeabi-v7a__ndk_target_25
[INFO]:    kivy is already unpacked, skipping
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython3 for armeabi-v7a
[INFO]:    hostpython3 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for hostpython3[armeabi-v7a]
[INFO]:    hostpython3 already patched, skipping
[INFO]:    Prebuilding libffi for armeabi-v7a
[INFO]:    libffi has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for libffi[armeabi-v7a]
[INFO]:    libffi already patched, skipping
[INFO]:    Prebuilding openssl for armeabi-v7a
[INFO]:    openssl has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding sdl2_image for armeabi-v7a
[INFO]:    sdl2_image has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2_image[armeabi-v7a]
[INFO]:    sdl2_image already patched, skipping
[INFO]:    Prebuilding sdl2_mixer for armeabi-v7a
[INFO]:    sdl2_mixer has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding sdl2_ttf for armeabi-v7a
[INFO]:    sdl2_ttf has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding sqlite3 for armeabi-v7a
[INFO]:    sqlite3 has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding python3 for armeabi-v7a
[INFO]:    python3 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for python3[armeabi-v7a]
[INFO]:    python3 already patched, skipping
[INFO]:    Prebuilding sdl2 for armeabi-v7a
[INFO]:    sdl2 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2[armeabi-v7a]
[INFO]:    sdl2 already patched, skipping
[INFO]:    Prebuilding setuptools for armeabi-v7a
[INFO]:    setuptools has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding six for armeabi-v7a
[INFO]:    six has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding pyjnius for armeabi-v7a
[INFO]:    pyjnius has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for pyjnius[armeabi-v7a]
[INFO]:    pyjnius already patched, skipping
[INFO]:    Prebuilding android for armeabi-v7a
[INFO]:    android has no prebuild_armeabi_v7a, skipping
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/android-sdl2/armeabi-v7a__ndk_target_25/android
[INFO]:    <- directory context /home/john/dev/python/android
[INFO]:    Prebuilding kivy for armeabi-v7a
[INFO]:    kivy has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for kivy[armeabi-v7a]
[INFO]:    kivy already patched, skipping
[INFO]:    # Building recipes
[INFO]:    Building hostpython3 for armeabi-v7a
[INFO]:    hostpython3 said it is already built, skipping
[INFO]:    Building libffi for armeabi-v7a
[INFO]:    -> directory context /home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi
[INFO]:    �[90m->�[0m running autoreconf -vif
[INFO]:    �[90m->�[0m running configure --host=arm-linux-androideabi --pref...(and 140 more)
Exception in thread background thread for pid 82687:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 1641, in wrap
    fn(*rgs, **kwargs)
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 2569, in background_thread
    handle_exit_code(exit_code)
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 2269, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_77: 

  RAN: /home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi/configure --host=arm-linux-androideabi --prefix=/home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi --disable-builddir --enable-shared

  STDOUT:
checking build system type... x86_64-pc-linux-gnux32
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... /home/john/Documents/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-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... /usr/bin/ccache /home/john/Documents/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi25 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details


  STDERR:

Traceback (most recent call last):
  File "/home/john/.local/bin/p4a", line 8, in <module>
    sys.exit(main())
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/toolchain.py", line 680, in __init__
    getattr(self, command)(args)
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/toolchain.py", line 99, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/toolchain.py", line 158, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx,
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/build.py", line 504, in build_recipes
    recipe.build_arch(arch)
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/recipes/libffi/__init__.py", line 30, in build_arch
    shprint(sh.Command('./configure'),
  File "/home/john/.local/lib/python3.10/site-packages/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 915, in next
    self.wait()
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 845, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/john/.local/lib/python3.10/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_77: 

  RAN: /home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi/configure --host=arm-linux-androideabi --prefix=/home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi --disable-builddir --enable-shared

  STDOUT:
checking build system type... x86_64-pc-linux-gnux32
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... /home/john/Documents/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-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... /usr/bin/ccache /home/john/Documents/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi25 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/john/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_25/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details


  STDERR:

I saw there were other issues made with the same problem, but they were all closed and not resolved.
Is it so to understand that WSL whether version 1 or 2 is entirely unsupported?
My C drive, for Windows to work, is an NTFS drive, but all the P4A, android-sdk, ndk, etc, are all stored inside the WSL drive.

Copy link

👋 @Source61,
Sorry to hear you are having difficulties with Kivy's python-for-android; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to python-for-android.
However, this issue appears to be a support request. Please use our support channels to get help with the project.
If you're having trouble installing python-for-android, please see our quickstart guide.
If you're having trouble using python-for-android, please see our troubleshooting guide and FAQ.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2024
@Source61
Copy link
Author

For anyone reading this: use buildozer instead. https://buildozer.readthedocs.io/en/latest/installation.html#targeting-android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants