kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.1k stars 1.81k forks source link

Are you able to build cffi==1.15.1? #2847

Closed xavierfiechter closed 7 months ago

xavierfiechter commented 11 months ago

Somehow, build fails due to this patch: https://github.com/kivy/python-for-android/commit/5ff00abad71d57c9bdba429c834696f0a6159e53

File "/home/user/.local/lib/python3.8/site-packages/sh.py", line 911, in next
    self.wait()
  File "/home/user/.local/lib/python3.8/site-packages/sh.py", line 841, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.8/site-packages/sh.py", line 865, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/patch -t -d /github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/cffi/arm64-v8a__ndk_target_21/cffi -p1 -i /github/workspace/master/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/cffi/disable-pkg-config.patch

  STDOUT:
patching file setup.py
Hunk #1 FAILED at 5.
Hunk #2 succeeded at 105 with fuzz 1 (offset 38 lines).
1 out of 2 hunks FAILED -- saving rejects to file setup.py.rej

  STDERR:

# Command failed: ['/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=brainbow', '--bootstrap=sdl2', '--requirements=python==3.10,cffi==1.15.1,pbkdf2,Cython==0.29.32,typing-extensions==4.4.0,aioconsole==0.1.10,aiosignal==1.2.0,appdirs==1.4.4,async-timeout==4.0.2,asyncgui==0.5.5,asynckivy==0.5.4,aiohttp==3.8.3,attrs==17.4.0,beautifulsoup4==4.6.0,certifi==2018.1.18,chardet==3.0.4,charset-normalizer==2.1.1,colorama==0.4.5,distlib==0.3.6,docutils==0.14,filelock==3.8.0,frozenlist==1.3.1,idna==2.6,importlib-metadata==4.12.0,Jinja2==3.1.2,Kivy==2.1.0,kivymd==1.0.2,kivy-garden.qrcode==2021.314,MarkupSafe==2.1.1,multidict==6.0.2,pep517==0.6.0,pexpect==4.8.0,Pillow==8.4.0,platformdirs==2.5.2,ptyprocess==0.7.0,pycoin==0.80,pycryptodome==3.9.8,Pygments==2.2.0,pytoml==0.1.21,qrcode==5.3,requests==2.20.0,six==1.11.0,toml==0.10.2,urllib3==1.24.3,yarl==1.8.1,zipp==3.8.1,android,pyjnius==1.4.2,embit==0.7.0,numpy==1.22.3,camera4kivy==0.1.0,gestures4kivy==0.1.0,pillow==8.4.0,libiconv,libzbar,pyzbar==0.1.7,', '--arch=arm64-v8a', '--copy-libs', '--local-recipes', '/github/workspace/master/src/python-for-android/recipes', '--color=always', '--storage-dir=/github/workspace/master/.buildozer/android/platform/build-arm64-v8a', '--ndk-api=21', '--hook=/github/workspace/master/src/camerax_provider/gradle_options.py', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     GITHUB_STATE = '/github/file_commands/save_state_a0715f4c-2eef-424b-9007-652415b5ae3d'
#     ACTIONS_RUNTIME_TOKEN = '***'
#     ACTIONS_CACHE_URL = 'https://artifactcache.actions.githubusercontent.com/pE34gBuG3KYfoM7fHoCgkB40X8bNnG2Ft8aZZOg5IoFmZsNp9L/'
#     USER = 'user'
#     LANGUAGE = 'en_US.UTF-8'
#     CI = 'true'
#     HOSTNAME = '3333858e6f3f'
#     RUNNER_ENVIRONMENT = 'github-hosted'
#     GITHUB_ENV = '/github/file_commands/set_env_a0715f4c-2eef-424b-9007-652415b5ae3d'
#     WORK_DIR = '/home/user/hostcwd'
#     HOME = '/home/user'
#     SRC_DIR = '/home/user/src'
#     RUNNER_TEMP = '/home/runner/work/_temp'
#     GITHUB_EVENT_PATH = '/github/workflow/event.json'
#     GITHUB_REPOSITORY_OWNER = 'Bitcoin-Brainbow'
#     PYTHONUNBUFFERED = '1'
#     GITHUB_RETENTION_DAYS = '90'
#     GITHUB_HEAD_REF = ''
#     GITHUB_REPOSITORY_OWNER_ID = '113306748'
#     GITHUB_GRAPHQL_URL = 'https://api.github.com/graphql'
#     HOME_DIR = '/home/user'
#     BUILDOZER_WARN_ON_ROOT = '0'
#     ACTIONS_RUNTIME_URL = 'https://pipelines.actions.githubusercontent.com/pE34gBuG3KYfoM7fHoCgkB40X8bNnG2Ft8aZZOg5IoFmZsNp9L/'
#     RUNNER_OS = 'Linux'
#     GITHUB_API_URL = 'https://api.github.com/'
#     GITHUB_WORKFLOW = 'Build'
#     APP_ANDROID_ACCEPT_SDK_LICENSE = '1'
#     GITHUB_RUN_ID = '5444007407'
#     GITHUB_WORKFLOW_SHA = '25bb0dd711c6cbd26eede5a0cfee2295aa060021'
#     GITHUB_BASE_REF = ''
#     GITHUB_REF_TYPE = 'branch'
#     GITHUB_WORKFLOW_REF = 'Bitcoin-Brainbow/Brainbow/.github/workflows/build.yml@refs/heads/master'
#     GITHUB_ACTION_REPOSITORY = ''
#     PATH = '/github/workspace/master/.buildozer_global/android/platform/apache-ant-1.9.4/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#     RUNNER_TOOL_CACHE = '/opt/hostedtoolcache'
#     GITHUB_ACTION = 'buildozer'
#     GITHUB_TRIGGERING_ACTOR = 'xavierfiechter'
#     RUNNER_ARCH = 'X64'
#     GITHUB_RUN_NUMBER = '213'
#     LANG = 'en_US.UTF-8'
#     GITHUB_REF_NAME = 'master'
#     GITHUB_REPOSITORY = 'Bitcoin-Brainbow/Brainbow'
#     RUNNER_NAME = 'GitHub Actions 2'
#     INPUT_WORKDIR = '.'
#     GITHUB_ACTION_REF = ''
#     GITHUB_REPOSITORY_ID = '535701869'
#     GITHUB_ACTIONS = 'true'
#     GITHUB_REF_PROTECTED = 'false'
#     BUILDOZER_BIN = './bin'
#     INPUT_COMMAND = 'buildozer android debug'
#     GITHUB_JOB = 'build-android'
#     GITHUB_WORKSPACE = '/github/workspace'
#     BUILDOZER_BUILD_DIR = './.buildozer'
#     GITHUB_SHA = '25bb0dd711c6cbd26eede5a0cfee2295aa060021'
#     GITHUB_RUN_ATTEMPT = '1'
#     GITHUB_REF = 'refs/heads/master'
#     GITHUB_ACTOR = 'xavierfiechter'
#     INPUT_BUILDOZER_VERSION = 'stable'
#     GITHUB_ACTOR_ID = '31884704'
#     GITHUB_PATH = '/github/file_commands/add_path_a0715f4c-2eef-424b-9007-652415b5ae3d'
#     RUNNER_WORKSPACE = '/home/runner/work/Brainbow'
#     LC_ALL = 'en_US.UTF-8'
#     PWD = '/github/workspace/master'
#     GITHUB_SERVER_URL = 'https://github.com/'
#     GITHUB_EVENT_NAME = 'push'
#     GITHUB_OUTPUT = '/github/file_commands/set_output_a0715f4c-2eef-424b-9007-652415b5ae3d'
#     INPUT_REPOSITORY_ROOT = 'master'
#     GITHUB_STEP_SUMMARY = '/github/file_commands/step_summary_a0715f4c-2eef-424b-9007-652415b5ae3d'
#     PACKAGES_PATH = '/github/workspace/master/.buildozer_global/android/packages'
#     ANDROIDSDK = '/github/workspace/master/.buildozer_global/android/platform/android-sdk'
#     ANDROIDNDK = '/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '33'
#     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
Traceback (most recent call last):
  File "/action/entrypoint.py", line 159, in <module>
    main()
  File "/action/entrypoint.py", line 27, in main
    run_command(env["INPUT_COMMAND"])
  File "/action/entrypoint.py", line 135, in run_command
    retcode = subprocess.check_call(command, shell=True)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'buildozer android debug' returned non-zero exit status 1.
HyTurtle commented 11 months ago

Which branch are you using?

Generally you shouldn't state a version for packages that are obtained through a recipe. With the noted cffi, what you are likely seeing is the patch for version 1.13.2 from the master branch, opposed to the develop branch which has the updated patch for 1.15.1

xavierfiechter commented 11 months ago

Thanks for the hint.

I was indeed using the master branch. cffi works with the develop branch.

But now it crashes town the line.


[INFO]:    ENV:
export HOME='/home/user'
export CFLAGS='-target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC -I/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/Include'
export CXXFLAGS='-target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC'
export CPPFLAGS='-DANDROID -I/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/python-installs/brainbow/arm64-v8a/include/python3.1'
export LDFLAGS='  -L/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/libs_collections/brainbow/arm64-v8a -L/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/android-build -lpython3.10 -L/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/libs_collections/brainbow/arm64-v8a -L/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/libs_collections/brainbow  -L/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/bootstrap_builds/sdl2/obj/local/arm64-v8a '
export LDLIBS='-lm'
export USE_CCACHE='1'
export NDK_CCACHE='/usr/bin/ccache'
export PATH='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin:/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b:/github/workspace/master/.buildozer_global/android/platform/android-sdk/tools:/github/workspace/master/.buildozer_global/android/platform/apache-ant-1.9.4/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export CC='/usr/bin/ccache /github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC'
export CXX='/usr/bin/ccache /github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC'
export AR='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
export RANLIB='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib'
export STRIP='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --strip-unneeded'
export READELF='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf'
export OBJCOPY='/github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy'
export MAKE='make -j2'
export ARCH='arm64-v8a'
export NDK_API='android-21'
export LDSHARED='/usr/bin/ccache /github/workspace/master/.buildozer_global/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC -shared'
export BUILDLIB_PATH='/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/lib.linux-x86_64-3.10'
export PYTHONNOUSERSITE='1'
export LANG='en_GB.UTF-8'
export PYTHONPATH='/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib:/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages:/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/lib.linux-x86_64-3.10:/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/scripts-3.10:/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/temp.linux-x86_64-3.10'
export LIBLINK='NOTNONE'
export COPYLIBS='1'
export LIBLINK_PATH='/github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/pyjnius-sdl2/arm64-v8a__ndk_target_21/objects_pyjnius'
export NDKPLATFORM='NOTNONE'

[INFO]:    COMMAND:
cd /github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/pyjnius-sdl2/arm64-v8a__ndk_target_21/pyjnius && /github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v

[WARNING]: ERROR: /github/workspace/master/.buildozer/android/platform/build-arm64-v8a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 failed!
# Command failed: ['/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=brainbow', '--bootstrap=sdl2', '--requirements=python==3.10,cffi==1.15.1,pbkdf2,Cython==0.29.32,typing-extensions==4.4.0,aioconsole==0.1.10,aiosignal==1.2.0,appdirs==1.4.4,async-timeout==4.0.2,asyncgui==0.5.5,asynckivy==0.5.4,aiohttp==3.8.3,attrs==17.4.0,beautifulsoup4==4.6.0,certifi==2018.1.18,chardet==3.0.4,charset-normalizer==2.1.1,colorama==0.4.5,distlib==0.3.6,docutils==0.14,filelock==3.8.0,frozenlist==1.3.1,idna==2.6,importlib-metadata==4.12.0,Jinja2==3.1.2,Kivy==2.1.0,kivymd==1.0.2,kivy-garden.qrcode==2021.314,MarkupSafe==2.1.1,multidict==6.0.2,pep517==0.6.0,pexpect==4.8.0,Pillow==8.4.0,platformdirs==2.5.2,ptyprocess==0.7.0,pycoin==0.80,pycryptodome==3.9.8,Pygments==2.2.0,pytoml==0.1.21,qrcode==5.3,requests==2.20.0,six==1.11.0,toml==0.10.2,urllib3==1.24.3,yarl==1.8.1,zipp==3.8.1,android,pyjnius==1.4.2,embit==0.7.0,numpy==1.22.3,camera4kivy==0.1.0,gestures4kivy==0.1.0,pillow==8.4.0,libiconv,libzbar,pyzbar==0.1.7,', '--arch=arm64-v8a', '--copy-libs', '--local-recipes', '/github/workspace/master/src/python-for-android/recipes', '--color=always', '--storage-dir=/github/workspace/master/.buildozer/android/platform/build-arm64-v8a', '--ndk-api=21', '--hook=/github/workspace/master/src/camerax_provider/gradle_options.py', '--ignore-setup-py', '--debug']
# ENVIRONMENT:

Why not pin it?! This makes a build reproducible.

This is especially important for Bitcoin related software and products.

T-Dynamos commented 11 months ago

@xavierfiechter Please post full log.

xavierfiechter commented 11 months ago

Sure, but the output is too long to paste it here.

Here's the build log https://github.com/Bitcoin-Brainbow/Brainbow/actions/runs/5444846600/jobs/9903255128

T-Dynamos commented 11 months ago

@xavierfiechter in logs I see build is failing because of jnius build. You can fix that by changing your workflow to:

name: Build APK
on: [push,pull_request]

jobs:
  build-android:
    name: Build for Android
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build with Buildozer
        run: |
          pip3 install --user --upgrade buildozer Cython virtualenv
          export PATH=$PATH:~/.local/bin/
          export APP_ANDROID_ACCEPT_SDK_LICENSE=1
          export BUILDOZER_WARN_ON_ROOT=0
          sudo apt update
          sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
          cd ${{ github.workspace }}
          buildozer android debug
      - name: Upload artifacts
        uses: actions/upload-artifact@v2
        with:
          name: package
          path: bin/*.apk
misl6 commented 11 months ago

https://github.com/Bitcoin-Brainbow/Brainbow/blob/10a6dac18702bfdcdb46b24a78fe8075bff85a2f/Dockerfile#L1

Unfortunately, the buildozer image available on docker hub is definitely old and not compatible with newer python-for-android versions.

As suggested by @T-Dynamos , you can change your workflow in order to avoid the usage of the docker image.

Spoiler: We have planned to start re-deploying images for python-for-android and buildozer on docker hub (but no ETA)

Why not pin it?! This makes a build reproducible.

Some packages, like cffi, need to be patched in order to be cross-built for Android (or iOS), and if code changes, the patch is not compatible. (but, if you want to, you can try updating the recipe, or adding patches to support multiple cffi versions)

xavierfiechter commented 11 months ago

Thank you @misl6 and @T-Dynamos for your reply. I will check that out and report back.

I'm aware of the patched version in the recipe, and I have contributed a patch for "aiohttp" in the past.

I usually go along with the latest patched version within the recipes to keep up to date. There are so many moving parts and the build process breaks occasionally.

xavierfiechter commented 11 months ago

The build is failing.

Here's the build file:

https://github.com/Bitcoin-Brainbow/Brainbow/blob/master/.github/workflows/build.yml#L35 Not sure, if

Here's the log output:

Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 5.15.0-1040-azure
NEEDRESTART-KEXP: 5.15.0-1040-azure
NEEDRESTART-KSTA: 1
Traceback (most recent call last):
  File "/home/runner/.local/bin/buildozer", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1003, in run_command
    self.check_root()
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1030, in check_root
    warn_on_root = self.config.getdefault('buildozer', 'warn_on_root', '1')
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1184, in _get_config_default
    set_config_token_from_env(section, token, self.config)
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1242, in set_config_token_from_env
    config.set(section, token, env_var)
  File "/usr/lib/python3.10/configparser.py", line 1205, in set
    super().set(section, option, value)
  File "/usr/lib/python3.10/configparser.py", line 903, in set
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'buildozer'
Error: Process completed with exit code 1.
T-Dynamos commented 11 months ago

@xavierfiechter This line is wrong

path: ${{ steps.buildozer.outputs.filename }}

(in upload artifact)

xavierfiechter commented 11 months ago

Thanks @T-Dynamos , but computer says no.

https://github.com/Bitcoin-Brainbow/Brainbow/actions/runs/5453111703/jobs/9921539537

Updating Mono key store
Mono Certificate Store Sync - version 6.12.0.182
Populate Mono certificate store from a concatenated list of certificates.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

Importing into legacy system store:
I already trust 137, your new list has 137
Import process completed.

Importing into BTLS system store:
I already trust 136, your new list has 137
Certificate added: C=ES, CN=Autoridad de Certificacion Firmaprofesional CIF A62634068
1 new root certificates were added to your trust store.
Import process completed.
Done
done.
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 5.15.0-1040-azure
NEEDRESTART-KEXP: 5.15.0-1040-azure
NEEDRESTART-KSTA: 1
Traceback (most recent call last):
  File "/home/runner/.local/bin/buildozer", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1003, in run_command
    self.check_root()
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1030, in check_root
    warn_on_root = self.config.getdefault('buildozer', 'warn_on_root', '1')
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1184, in _get_config_default
    set_config_token_from_env(section, token, self.config)
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1242, in set_config_token_from_env
    config.set(section, token, env_var)
  File "/usr/lib/python3.10/configparser.py", line 1205, in set
    super().set(section, option, value)
  File "/usr/lib/python3.10/configparser.py", line 903, in set
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'buildozer'
Error: Process completed with exit code 1.
T-Dynamos commented 11 months ago

@xavierfiechter these lines are missing from your spec.

[buildozer]
log_level = 2
warn_on_root = 1

add them

xavierfiechter commented 11 months ago

All these lines are already in my spec.

https://github.com/Bitcoin-Brainbow/Brainbow/blob/master/buildozer.spec#L471-L477

RobertFlatt commented 11 months ago

The original issue is a newer version of Cython is required

jnius/jnius.c:55290:5: error: expression is not assignable ++Py_REFCNT(o);

https://github.com/Android-for-Python/Android-for-Python-Users#error-expression-is-not-assignable

As specified in the install docs

https://github.com/kivy/buildozer/blob/master/docs/source/installation.rst#android-on-ubuntu-2004-and-2204-64bit

xavierfiechter commented 10 months ago

@RobertFlatt this build is failing with Cython==0.29.33 as well.

Here's the log: https://github.com/Bitcoin-Brainbow/Brainbow/actions/runs/5685488668/job/15410462879

RobertFlatt commented 10 months ago

@xavierfiechter

configparser.NoSectionError: No section: 'buildozer'

I suggest this is unrelated to Cython, you might want to check if buildozer.spec is truncated.

Which I see is also a suggestion above https://github.com/kivy/python-for-android/issues/2847#issuecomment-1620430007

xavierfiechter commented 10 months ago

Thanks, Robert, for your response.

Those lines are in buildozer.spec, here:

https://github.com/Bitcoin-Brainbow/Brainbow/blob/master/buildozer.spec#L474-L480

Any other ideas? Hints?

HyTurtle commented 10 months ago

Should be python3 in requirements and the Cython version as mentioned is in relation to the build system ie addressed in build.yml and I would use version 0.29.36

xavierfiechter commented 10 months ago

Not sure if I understand it correctly.

I took the Python version from https://github.com/Bitcoin-Brainbow/Brainbow/blob/master/.github/workflows/build.yml#L62 and added it into the buildozer.spec under requirements.

Also added the suggested version of Cpython.

NEEDRESTART-KSTA: 1
Traceback (most recent call last):
  File "/home/runner/.local/bin/buildozer", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1003, in run_command
    self.check_root()
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1030, in check_root
    warn_on_root = self.config.getdefault('buildozer', 'warn_on_root', '1')
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1184, in _get_config_default
    set_config_token_from_env(section, token, self.config)
  File "/home/runner/.local/lib/python3.10/site-packages/buildozer/__init__.py", line 1242, in set_config_token_from_env
    config.set(section, token, env_var)
  File "/usr/lib/python3.10/configparser.py", line 1205, in set
    super().set(section, option, value)
  File "/usr/lib/python3.10/configparser.py", line 903, in set
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'buildozer'
Error: Process completed with exit code 1.

Getting this error from this build https://github.com/Bitcoin-Brainbow/Brainbow/actions/runs/5685921100/job/15411794780.

I assume the error is triggered by something else, because both lines log_level = 2 warn_on_root = 1 are in the [buildozer] section.

RobertFlatt commented 10 months ago

@xavierfiechter

You have syntax errors in your buildozer.spec

The syntax is .ini syntax

See https://github.com/Android-for-Python/Android-for-Python-Users#changing-buildozerspec

xavierfiechter commented 10 months ago

I used the format of the file for 100s of builds.

Because I can't find any anomaly in the file, I just used this script to read from my buildozer.spec locally.

# works with Python 3.11.3 
import configparser

def parse_buildozer_config(config_file):
    parser = configparser.ConfigParser()
    parser.read(config_file)
    if 'buildozer' in parser:
        buildozer_section = parser['buildozer']
        log_level = buildozer_section.getint('log_level', fallback=0)
        build_dir = buildozer_section.get('dir', fallback='.')
        return log_level, build_dir
    else:
        # Handle the case when the 'buildozer' section is not found in the config file
        return None, None

# Usage
config_file_path = 'buildozer.spec'
log_level, build_dir = parse_buildozer_config(config_file_path)

if log_level is not None and build_dir is not None:
    print(f"Buildozer log level: {log_level}")
    print(f"Buildozer project directory: {build_dir}")
else:
    print("Could not find the 'buildozer' section in the config file.")

I had no issue, so it must be something else. But what?

https://github.com/Bitcoin-Brainbow/Brainbow/actions/runs/5689024819/job/15419807716

RobertFlatt commented 10 months ago

I can only explicity paste this from the link previously provided

Note: buildozer.spec syntax is .ini syntax, so there is no syntax checking.

Options must start on the first character of a line. Comments must start on the first character of a line. Comments must not be imbedded in multi-line options. Failure to follow this syntax may result in non-deterministic behavior.

Given the last item, a deterministic test is probably not meaningful. As a general strategy I suggest trying to find what is not correct.

I'm obviously not going to look for all the issues in your code, but for example https://github.com/Bitcoin-Brainbow/Brainbow/blob/master/buildozer.spec#L37-L40 See the two items about comments above.

xavierfiechter commented 10 months ago

https://github.com/kivy/python-for-android/issues/2799

xavierfiechter commented 10 months ago

Build works when using p4a release-2022.12.20.

github-actions[bot] commented 7 months ago

👋 We use the issue tracker exclusively for bug reports and feature requests. 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 or using python-for-android, maybe you could be interested in our quickstart guide.

Let us know if this comment was made in error, and we'll be happy to reopen the issue.