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

buildozer fails MacOS Exec format error #1649

Closed
marcmaxson opened this issue Aug 1, 2023 · 2 comments
Closed

buildozer fails MacOS Exec format error #1649

marcmaxson opened this issue Aug 1, 2023 · 2 comments

Comments

@marcmaxson
Copy link

Versions

  • Python: 3.9.12
  • OS: MacOS 12.5 (Monterrey)
  • Buildozer: 1.5.0

Description

I'm trying to compile some pygame python files to run on Android using buildozer. buildozer -v android debug returns an error, though I can't figure out what dependency is broken or missing:

buildozer.spec

[app]

# (str) Title of your application
title = Qin Kingdoms

# (str) Package name
package.name = qinkingdoms

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

# (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,kv,atlas

# (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 = drafts, tests, bin, venv

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

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

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

# (list) Supported orientations
# Valid options are: landscape, portrait, portrait-reverse or landscape-reverse
orientation = portrait

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

# (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
# In past, was `android.arch` as we weren't supporting builds for multiple archs at the same time.
android.archs = 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

# (bool) enables Android auto backup feature (Android API >=23)
android.allow_backup = True

# (str) XML file for custom backup rules (see official auto backup documentation)
# android.backup_rules =

#
# Python for android (p4a) specific
#

# (str) python-for-android branch to use, defaults to master
p4a.branch = develop
ontrol passing the --use-setup-py vs --ignore-setup-py to p4a
# "in the future" --use-setup-py is going to be the default behaviour in p4a, right now it is not
# Setting this to false will pass --ignore-setup-py, true will pass --use-setup-py
# NOTE: this is general setuptools integration, having pyproject.toml is enough, no need to generate
# setup.py if you're using Poetry, but you need to add "toml" to source.include_exts.
#p4a.setup_py = false

# (str) extra command line arguments to pass when invoking pythonforandroid.toolchain
#p4a.extra_args =



#
# iOS specific
#

# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios
# Alternately, specify the URL and branch of a git checkout:
ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master

# Another platform dependency: ios-deploy
# Uncomment to use a custom checkout
#ios.ios_deploy_dir = ../ios_deploy
# Or specify URL and branch
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.10.0

# (bool) Whether or not to sign the code
ios.codesign.allowed = false

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) The development team to use for signing the debug version
#ios.codesign.development_team.debug = <hexstring>

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s

# (str) The development team to use for signing the release version
#ios.codesign.development_team.release = <hexstring>

# (str) URL pointing to .ipa file to be installed
# This option should be defined along with `display_image_url` and `full_size_image_url` options.
#ios.manifest.app_url =

# (str) URL pointing to an icon (57x57px) to be displayed during download
# This option should be defined along with `app_url` and `full_size_image_url` options.
#ios.manifest.display_image_url =

# (str) URL pointing to a large icon (512x512px) to be used by iTunes
# This option should be defined along with `app_url` and `display_image_url` options.
#ios.manifest.full_size_image_url =


[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 = 1

#[app@demo]
title = Qin Kingdoms (free demo)

Logs

[WARNING]: install_libs called with no libraries to install!
[INFO]:    Building libffi for armeabi-v7a
[INFO]:    -> directory context /Volumes/MM/kingdoms/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi
[DEBUG]:   -> running autoreconf -vif
[DEBUG]:   	autoreconf: export WARNINGS=
[DEBUG]:   	autoreconf: Entering directory '.'
[DEBUG]:   	autoreconf: configure.ac: not using Gettext
[DEBUG]:   	autoreconf: running: aclocal --force -I m4
[DEBUG]:   	autoreconf: configure.ac: tracing
[DEBUG]:   	autoreconf: configure.ac: not using Libtool
[DEBUG]:   	autoreconf: configure.ac: not using Intltool
[DEBUG]:   	autoreconf: configure.ac: not using Gtkdoc
[DEBUG]:   	autoreconf: running: /usr/local/Cellar/autoconf/2.71/bin/autoconf --force
[DEBUG]:   	autoreconf: configure.ac: not using Autoheader
[DEBUG]:   	autoreconf: configure.ac: not using Automake
[DEBUG]:   	autoreconf: Leaving directory '.'
[DEBUG]:   -> running configure --host=arm-linux-androideabi --prefix=/Volumes/MM/kingdoms/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1268, in <module>
    main()
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 681, in __init__
    getattr(self, command)(args)
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 100, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 159, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx,
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 504, in build_recipes
    recipe.build_arch(arch)
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 30, in build_arch
    shprint(sh.Command('./configure'),
  File "/Volumes/MM/kingdoms/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 166, in shprint
    output = command(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.9/site-packages/sh.py", line 1524, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/opt/anaconda3/lib/python3.9/site-packages/sh.py", line 780, in __init__
    self.process = OProc(self, self.log, cmd, stdin, stdout, stderr,
  File "/opt/anaconda3/lib/python3.9/site-packages/sh.py", line 2125, in __init__
    raise ForkException(fork_exc)
sh.ForkException: 

Original exception:
===================

    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.9/site-packages/sh.py", line 2080, in __init__
        os.execve(cmd[0], cmd, ca["env"])
    OSError: [Errno 8] Exec format error: b'/Volumes/MM/kingdoms/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure'
    

# Command failed: ['/opt/anaconda3/bin/python', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=qinkingdoms', '--bootstrap=sdl2', '--requirements=python3,kivy,pygame', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/Volumes/MM/kingdoms/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     __CFBundleIdentifier = 'com.apple.Terminal'
#     TMPDIR = '/var/folders/5g/7kkhxfz921b08z_tt4d7tq2c0000gn/T/'
#     XPC_FLAGS = '0x0'
#     TERM = 'xterm-256color'
#     SSH_AUTH_SOCK = '/private/tmp/com.apple.launchd.PAMBpcO7DE/Listeners'
#     XPC_SERVICE_NAME = '0'
#     TERM_PROGRAM = 'Apple_Terminal'
#     TERM_PROGRAM_VERSION = '445'
#     TERM_SESSION_ID = 'DBEF9724-7B70-43F2-BB0C-E6697A1956E7'
#     SHELL = '/bin/zsh'
#     HOME = '/Users/marcmaxmeister'
#     LOGNAME = 'marcmaxmeister'
#     USER = 'marcmaxmeister'
#     PATH = '/Users/marcmaxmeister/.buildozer/android/platform/apache-ant-1.9.4/bin:/Users/marcmaxmeister/.rvm/gems/ruby-3.2.0/bin:/Users/marcmaxmeister/.rvm/gems/ruby-3.2.0@global/bin:/Users/marcmaxmeister/.rvm/rubies/ruby-3.2.0/bin:/usr/local/opt/openssl@3/bin:/Users/marcmaxmeister/.gem/ruby/3.2.0/bin:/Users/marcmaxmeister/google-cloud-sdk/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/marcmaxmeister/.cargo/bin:/Users/marcmaxmeister/.rvm/bin'
#     SHLVL = '1'
#     PWD = '/Volumes/MM/kingdoms'
#     OLDPWD = '/Volumes/MM'
#     CONDA_EXE = '/opt/anaconda3/bin/conda'
#     _CE_M = ''
#     _CE_CONDA = ''
#     CONDA_PYTHON_EXE = '/opt/anaconda3/bin/python'
#     CONDA_SHLVL = '1'
#     CONDA_PREFIX = '/opt/anaconda3'
#     CONDA_DEFAULT_ENV = 'base'
#     CONDA_PROMPT_MODIFIER = '(base) '
#     GEM_PATH = '/Users/marcmaxmeister/.rvm/gems/ruby-3.2.0:/Users/marcmaxmeister/.rvm/gems/ruby-3.2.0@global'
#     rvm_prefix = '/Users/marcmaxmeister'
#     rvm_path = '/Users/marcmaxmeister/.rvm'
#     rvm_bin_path = '/Users/marcmaxmeister/.rvm/bin'
#     rvm_version = '1.29.12-next (master)'
#     GEM_HOME = '/Users/marcmaxmeister/.rvm/gems/ruby-3.2.0'
#     MY_RUBY_HOME = '/Users/marcmaxmeister/.rvm/rubies/ruby-3.2.0'
#     IRBRC = '/Users/marcmaxmeister/.rvm/rubies/ruby-3.2.0/.irbrc'
#     RUBY_VERSION = 'ruby-3.2.0'
#     rvm_alias_expanded = ''
#     rvm_bin_flag = ''
#     rvm_docs_type = ''
#     rvm_gemstone_package_file = ''
#     rvm_gemstone_url = ''
#     rvm_niceness = ''
#     rvm_nightly_flag = ''
#     rvm_only_path_flag = ''
#     rvm_pretty_print_flag = ''
#     rvm_proxy = ''
#     rvm_quiet_flag = ''
#     rvm_ruby_bits = ''
#     rvm_ruby_file = ''
#     rvm_ruby_make = ''
#     rvm_ruby_make_install = ''
#     rvm_ruby_mode = ''
#     rvm_script_name = ''
#     rvm_sdk = ''
#     rvm_silent_flag = ''
#     rvm_use_flag = ''
#     rvm_hook = ''
#     LANG = 'en_US.UTF-8'
#     _ = '/opt/anaconda3/bin/buildozer'
#     __CF_USER_TEXT_ENCODING = '0x1F5:0x0:0x0'
#     PACKAGES_PATH = '/Users/marcmaxmeister/.buildozer/android/packages'
#     ANDROIDSDK = '/Users/marcmaxmeister/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/Users/marcmaxmeister/.buildozer/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '31'
#     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
@misl6
Copy link
Member

misl6 commented Aug 6, 2023

Can you please try the following and report back?

  • Delete /Volumes/MM/kingdoms/.buildozer folder and try again.

if the above suggestion fails:

  • Delete /Volumes/MM/kingdoms/.buildozer folder.
  • Install buildozer via a non-anaconda python, and run it from the non-anaconda python.

@Julian-O
Copy link
Contributor

Closing as stale.

@Julian-O Julian-O closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants