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

dlopen failed: cannot locate symbol "_ZNSt12length_errorD1Ev" while loading matplotlib/_path.so on Android 12 #2675

Closed
Epicwow opened this issue Sep 22, 2022 · 38 comments

Comments

@Epicwow
Copy link

Epicwow commented Sep 22, 2022

Hi,

I have writing an test app with matplotlib. but it don't work on my Android phone (Android 12)

Below is the test app

import kivy
from kivy.app import App
import matplotlib

class MainApp(App):
    pass

if __name__ == '__main__':
    MainApp().run()

Adb logcat show failed reason:

09-22 10:02:52.386 15320 15371 I python  : [INFO   ] [Factory     ] 189 symbols loaded
09-22 10:02:52.502 15320 15371 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
09-22 10:02:52.585 15320 15371 I python  :  Traceback (most recent call last):
09-22 10:02:52.585 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/app/main.py", line 3, in <module>
09-22 10:02:52.585 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/__init__.py", line 109, in <module>
09-22 10:02:52.586 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/rcsetup.py", line 27, in <module>
09-22 10:02:52.586 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/colors.py", line 56, in <module>
09-22 10:02:52.586 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/scale.py", line 23, in <module>
09-22 10:02:52.586 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/ticker.py", line 136, in <module>
09-22 10:02:52.586 15320 15371 I python  :    File "/workspace/kivy_sample/testapp/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myapp/arm64-v8a/matplotlib/transforms.py", line 46, in <module>
09-22 10:02:52.587 15320 15371 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZNSt12length_errorD1Ev" referenced by "/data/user/0/org.test.myapp/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
09-22 10:02:52.587 15320 15371 I python  : Python for android ended.

buildozer.spec

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

# (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, kivy, plyer, android, numpy, Pyjnius, matplotlib

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

# (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 = 0

# (string) Presplash background color (for 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 = #FFFFFF

# (string) Presplash animation using Lottie format.
# see https://lottiefiles.com/ for examples and https://airbnb.design/lottie/
# for general documentation.
# Lottie files can be created using various tools, like Adobe After Effect or Synfig.
#android.presplash_lottie = "path/to/lottie/file.json"

# (str) Adaptive icon of the application (used if Android API level is 26+ at runtime)
#icon.adaptive_foreground.filename = %(source.dir)s/data/icon_fg.png
#icon.adaptive_background.filename = %(source.dir)s/data/icon_bg.png

# (list) Permissions
android.permissions = INTERNET, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION

# (list) features (adds uses-feature -tags to manifest)
#android.features = android.hardware.usb.host

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

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

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

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

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

# (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 =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =

# (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 = False

# (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 = False

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

# (str) Full name including package path of the Java class that implements Android Activity
# use that parameter together with android.entrypoint to set custom Java class instead of PythonActivity
#android.activity_class_name = org.kivy.android.PythonActivity

# (str) Extra xml to write directly inside the <manifest> element of AndroidManifest.xml
# use that parameter to provide a filename from where to load your custom XML code
#android.extra_manifest_xml = ./src/android/extra_manifest.xml

# (str) Extra xml to write directly inside the <manifest><application> tag of AndroidManifest.xml
# use that parameter to provide a filename from where to load your custom XML arguments:
#android.extra_manifest_application_arguments = ./src/android/extra_manifest_application_arguments.xml

# (str) Full name including package path of the Java class that implements Python Service
# use that parameter to set custom Java class instead of PythonService
#android.service_class_name = org.kivy.android.PythonService

# (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 = ./java/

# (list) Android AAR archives to add
#android.add_aars =

# (list) Put these files or directories in the apk assets directory.
# Either form may be used, and assets need not be in 'source.include_exts'.
# 1) android.add_assets = source_asset_relative_path
# 2) android.add_assets = source_asset_path:destination_asset_relative_path
#android.add_assets =

# (list) Gradle dependencies to add
#android.gradle_dependencies =

# (bool) Enable AndroidX support. Enable when 'android.gradle_dependencies'
# contains an 'androidx' package, or any package from Kotlin source.
# android.enable_androidx requires android.api >= 28
#android.enable_androidx = False

# (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_packaging_options =

# (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) Android logcat only display log for activity's pid
#android.logcat_pid_only = False

# (str) Android additional adb arguments
#android.adb_args = -H host.docker.internal

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

# (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

# (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 =

# (str) If you need to insert variables into your AndroidManifest.xml file,
# you can do so with the manifestPlaceholders property.
# This property takes a map of key-value pairs. (via a string)
# Usage example : android.manifest_placeholders = [myCustomUrl:\"org.kivy.customurl\"]
# android.manifest_placeholders = [:]

# (bool) disables the compilation of py to pyc/pyo files when packaging
# android.no-compile-pyo = True

# (str) The format used to package the app for release mode (aab or apk).
# android.release_artifact = aab

#
# Python for android (p4a) specific
#

# (str) python-for-android URL to use for checkout
#p4a.url =

# (str) python-for-android fork to use in case if p4a.url is not specified, defaults to upstream (kivy)
#p4a.fork = kivy

# (str) python-for-android branch to use, defaults to master
#p4a.branch = master

# (str) python-for-android specific commit to use, defaults to HEAD, must be within p4a.branch
#p4a.commit = HEAD

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =

# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =

# (str) Filename to the hook for p4a
#p4a.hook =

# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2

# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =

# Control 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

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

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

#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#


#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug

buildozer Logs with command [buildozer android debug deploy ]

buildozer.log

@misl6 misl6 moved this to Needs Triage in Kivy's Control Tower Sep 22, 2022
@misl6
Copy link
Member

misl6 commented Sep 24, 2022

Hi @Epicwow !

Can you please post the full runtime log?

@Epicwow
Copy link
Author

Epicwow commented Sep 26, 2022

Hi @misl6

Apologies for the Late Reply.
Please checking above runtime log, thanks
runtime.log

@Epicwow
Copy link
Author

Epicwow commented Sep 26, 2022

Also post kivy log of App [/data/user/0/org.test.myapp/files/app/.kivy/logs/kivy_22-09-26_0.txt]

kivy_22-09-26_0.txt

@misl6
Copy link
Member

misl6 commented Sep 26, 2022

Thank you for the runtime logs!
There's a chance that you did a build before 2022-09-04 ?

Can you delete your .buildozer folder and launch a new build if that's the case?

@Epicwow
Copy link
Author

Epicwow commented Sep 27, 2022

Hi @misl6
I have deleted .buildozer folder and rebuild it, but this issue still exists.

@misl6
Copy link
Member

misl6 commented Sep 27, 2022

Did you have the chance to test it on another device? Can you share the APK?

@gorgonaut04
Copy link

Hello, I have a similar issue, Android 11 on a OnePlus 8T:

09-30 16:11:52.802  7076 22341 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/user/0/com.maxentric.deplife/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
09-30 16:11:52.802  7076 22341 I python  : Python for android ended.

I also deleted the .buildozer directory in my app's directory, with no change.
I would upload apk but it's 49MB :(

@gorgonaut04
Copy link

FWIW, I switched to tag v2022.07.20 and got a bit different error:

09-30 16:52:51.979 10060 10203 I python  :  Traceback (most recent call last):
09-30 16:52:51.979 10060 10203 I python  :    File "/home/maxentric/deplife/.buildozer/android/app/main.py", line 15, in <module>
09-30 16:52:51.979 10060 10203 I python  :    File "/home/maxentric/deplife/.buildozer/android/platform/build-arm64-v8a/build/python-installs/deplife/arm64-v8a/matplotlib/__init__.py", line 205, in <module>
09-30 16:52:51.980 10060 10203 I python  :    File "/home/maxentric/deplife/.buildozer/android/platform/build-arm64-v8a/build/python-installs/deplife/arm64-v8a/matplotlib/__init__.py", line 190, in _check_versions
09-30 16:52:51.980 10060 10203 I python  :  ImportError: dlopen failed: TLS symbol "_ZZN8gwp_asan15getThreadLocalsEvE6Locals" in dlopened "/data/user/0/com.maxentric.deplife/files/app/_python_bundle/site-packages/matplotlib/ft2font.so" referenced from "/data/user/0/com.maxentric.deplife/files/app/_python_bundle/site-packages/matplotlib/ft2font.so" using IE access model
09-30 16:52:51.980 10060 10203 I python  : Python for android ended.

@misl6
Copy link
Member

misl6 commented Oct 2, 2022

Hello, I have a similar issue, Android 11 on a OnePlus 8T:

09-30 16:11:52.802  7076 22341 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/user/0/com.maxentric.deplife/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
09-30 16:11:52.802  7076 22341 I python  : Python for android ended.

I also deleted the .buildozer directory in my app's directory, with no change. I would upload apk but it's 49MB :(

Google Drive or something similar is fine :)

@misl6
Copy link
Member

misl6 commented Oct 2, 2022

Wait, I may have an idea. Will ping you back soon.

@misl6 misl6 moved this from Needs Triage to In Progress in Kivy's Control Tower Oct 2, 2022
@misl6
Copy link
Member

misl6 commented Oct 2, 2022

@gorgonaut04 @Epicwow
Nope, unfortunately, I can't reproduce it.
A full (unfiltered) log and the apk may help :)

@misl6 misl6 moved this from In Progress to Needs Triage in Kivy's Control Tower Oct 2, 2022
@tytgatlieven
Copy link

Dear

I have the same issue.

I have built the testapp mentioned above.
You can find the file here:
https://documents.tymeli.be/s/KZ43dfw3qQnYARg

There is a readme.md how to build the docker containers and how to build the app. Do not forget to clear cache folders in you home dir when rebuilding.

There are two apks in the bin folder: One build is using ubuntu 20.04 as base, the other ubuntu 22.04.

@misl6
Copy link
Member

misl6 commented Oct 5, 2022

Dear

I have the same issue.

I have built the testapp mentioned above. You can find the file here: https://documents.tymeli.be/s/KZ43dfw3qQnYARg

There is a readme.md how to build the docker containers and how to build the app. Do not forget to clear cache folders in you home dir when rebuilding.

There are two apks in the bin folder: One build is using ubuntu 20.04 as base, the other ubuntu 22.04.

Thank you for the APK! Has been super-helpful.

How ft2font.so looks like in your APK (libc++_shared.so and libm.so are missing):

Dynamic section at offset 0x1dde0 contains 28 entries:
  Tag                Type           Name/Value
  0x0000000000000001 (NEEDED)       Shared library: [libpython3.9.so]
  0x0000000000000001 (NEEDED)       Shared library: [libfreetype.so]
  0x0000000000000001 (NEEDED)       Shared library: [libdl.so]
  0x0000000000000001 (NEEDED)       Shared library: [libc.so]
  0x000000000000001e (FLAGS)        BIND_NOW 
  0x000000006ffffffb (FLAGS_1)      NOW 
  0x0000000000000007 (RELA)         0x5010
  0x0000000000000008 (RELASZ)       8496 (bytes)
  0x0000000000000009 (RELAENT)      24 (bytes)
  0x000000006ffffff9 (RELACOUNT)    251
  0x0000000000000017 (JMPREL)       0x7140
  0x0000000000000002 (PLTRELSZ)     2856 (bytes)
  0x0000000000000003 (PLTGOT)       0x201a0
  0x0000000000000014 (PLTREL)       RELA
  0x0000000000000006 (SYMTAB)       0x308
  0x000000000000000b (SYMENT)       24 (bytes)
  0x0000000000000005 (STRTAB)       0x2d7c
  0x000000000000000a (STRSZ)        8845 (bytes)
  0x000000006ffffef5 (GNU_HASH)     0x20c0
  0x0000000000000004 (HASH)         0x2464
  0x0000000000000019 (INIT_ARRAY)   0x1fdd0
  0x000000000000001b (INIT_ARRAYSZ) 16 (bytes)
  0x000000000000001a (FINI_ARRAY)   0x1fdc0
  0x000000000000001c (FINI_ARRAYSZ) 16 (bytes)
  0x000000006ffffff0 (VERSYM)       0x1e38
  0x000000006ffffffe (VERNEED)      0x207c
  0x000000006fffffff (VERNEEDNUM)   2
  0x0000000000000000 (NULL)         0x0

How it should look like:

Dynamic section at offset 0x1db40 contains 30 entries:
Tag                Type           Name/Value
0x0000000000000001 (NEEDED)       Shared library: [libpython3.9.so]
0x0000000000000001 (NEEDED)       Shared library: [libfreetype.so]
0x0000000000000001 (NEEDED)       Shared library: [libc++_shared.so]
0x0000000000000001 (NEEDED)       Shared library: [libm.so]
0x0000000000000001 (NEEDED)       Shared library: [libdl.so]
0x0000000000000001 (NEEDED)       Shared library: [libc.so]
0x000000000000001e (FLAGS)        BIND_NOW 
0x000000006ffffffb (FLAGS_1)      NOW 
0x0000000000000007 (RELA)         0x5178
0x0000000000000008 (RELASZ)       6264 (bytes)
0x0000000000000009 (RELAENT)      24 (bytes)
0x000000006ffffff9 (RELACOUNT)    158
0x0000000000000017 (JMPREL)       0x69f0
0x0000000000000002 (PLTRELSZ)     2856 (bytes)
0x0000000000000003 (PLTGOT)       0x1ff48
0x0000000000000014 (PLTREL)       RELA
0x0000000000000006 (SYMTAB)       0x308
0x000000000000000b (SYMENT)       24 (bytes)
0x0000000000000005 (STRTAB)       0x2e38
0x000000000000000a (STRSZ)        9023 (bytes)
0x000000006ffffef5 (GNU_HASH)     0x2148
0x0000000000000004 (HASH)         0x2500
0x0000000000000019 (INIT_ARRAY)   0x1fb30
0x000000000000001b (INIT_ARRAYSZ) 16 (bytes)
0x000000000000001a (FINI_ARRAY)   0x1fb20
0x000000000000001c (FINI_ARRAYSZ) 16 (bytes)
0x000000006ffffff0 (VERSYM)       0x1e98
0x000000006ffffffe (VERNEED)      0x20e4
0x000000006fffffff (VERNEEDNUM)   3
0x0000000000000000 (NULL)         0x0

Will setup a test environ with an older version of the NDK + Ubuntu.

Did you tried to use NDK 25? (python-for-android develop version now uses it by default)

@misl6 misl6 moved this from Needs Triage to In Progress in Kivy's Control Tower Oct 5, 2022
@misl6 misl6 added bug and removed awaiting-reply labels Oct 5, 2022
@tytgatlieven
Copy link

Dear

I have build the testapp with a buildozer based on current master buildozer (b8575fd, but using python-for-android develop branch. (fork: 0c6752b

Still the same problem.

apk: https://documents.tymeli.be/s/27zR6Dr7MoQ5E5D

hope this helps you forward.

@magowiz
Copy link

magowiz commented Nov 16, 2022

same issue here

@gorgonaut04
Copy link

gorgonaut04 commented Nov 16, 2022

I wonder if this error is equivalent to trying to run matplotlib>3.1.3 on PC/mac without png module installed? Might be why it works with <= 3.1.3 on android, but beyond that has issues (where the lack of png/"_png" causes issues on PC/mac). If someone wants to experiment you could try adding "png" to the list of modules in buildozer.spec.

@magowiz
Copy link

magowiz commented Nov 16, 2022

I tried with matplotlib==3.1.3 and png modules, with no luck, same issue. I'm trying also with matplotlib==3.1.2

@mp-007
Copy link
Contributor

mp-007 commented Nov 16, 2022

In previous recipe (matplotlib==3.1.3) I changed the line 128 in recipy.py file for .need_stl_shared = True to solve this issue (p4a version 2020.03.30)

@magowiz
Copy link

magowiz commented Nov 16, 2022

in which file?

@mp-007
Copy link
Contributor

mp-007 commented Nov 16, 2022

@magowiz
Copy link

magowiz commented Nov 16, 2022

I see we were seeing 2 different branches, I was using develop, in there init.py is smaller than 108 lines, anyway which is the strategy? Buildozer for example downloads these files, including recipes, so how to "patch" it?
For now I did:

  1. change the branch to yours ( v2020.06.02 )
  2. I will start buildozer build
  3. ctrl + c after python for android is downloaded
  4. edit the file init.py on line 124
  5. start again buildozer build

Does it work like this?

@mp-007
Copy link
Contributor

mp-007 commented Nov 16, 2022

if I correctly remember. I did a first buildozer build.
after in the buildozer folder, I changed the https://github.com/kivy/python-for-android/blob/v2020.06.02/pythonforandroid/recipe.py#L119 for True in recipe.py file in pythonforandroid folder
and start again a buildozer build

@magowiz
Copy link

magowiz commented Nov 16, 2022

I wasn't able to use branch v2020.06.02, tells me something about compatibility:

# This buildozer version requires a python-for-android version with AAB (Android App Bundle) support. Please update your pinned version accordingly.

I used develop, to avoid cache issue I removed .buildozer folder, I launched the build, interrupted as soon I get the recipe.py file, I found that line a few lines under, I started build again, I installed file in my phone, I get the same issue: ImportError: dlopen failed: cannot locate symbol "_ZTISt13runtime_error" referenced by "/data/user/0/xxxxxxxxx/files/app/_python_bundle/site-packages/matplotlib/ft2font.so"...
I used matplotlib==3.1.3

@mp-007
Copy link
Contributor

mp-007 commented Nov 16, 2022

can you used matplotib 3.5.2 like in matplotlib recipe.

@mp-007
Copy link
Contributor

mp-007 commented Nov 16, 2022

also for ft2font.so issue, have you install "apt install python-openssl" in your environnement.

@magowiz
Copy link

magowiz commented Nov 17, 2022

I got again same issue on matplotlib/_path.so
I tried with:

  • p4a fork: kivy
  • p4a branch: develop
  • changed recipe.py to enable need_stl_shared (on line 124)
  • matplotlib at 3.5.2
  • installed python3-openssl on my system

@mp-007
Copy link
Contributor

mp-007 commented Nov 17, 2022

OMG it's seem very complicated to make it work. I stopped 2 years making APK because it was hard for me to keep some app up to date with all android version and p4a changes.

If you find something, let me know.

FYI this was my reported issue 2 years ago with similar problem #2059.

@kulothunganug
Copy link
Contributor

I tried to build https://github.com/mp-007/kivy_matplotlib_widget/tree/main/example_basic but I get the same error as stated here, I also tried @mp-007 's workaround with a clean build, but it throws the same error.

+1

@KritikaVersha
Copy link

I am receiving the same error too after following all the suggestions. @misl6, @magowiz Were you able to find a workaround by any chance?

@tytgatlieven
Copy link

tytgatlieven commented Feb 5, 2023

Hi @KritikaVersha, all

After a lot of searching we (me and @robgar2001) were able to build the testapp (above) and another app using matplotlib. Both are running as they should.

However, the build needed to be executed on native debian bullseye using buildozer 1.5.0 and python-for-android v2023.01.28.
Building the same in a docker container running ubuntu 20.04 or ubuntu 22.04 has not yet been successful.

We will try to figure out the differences between debian and ubuntu

@misl6
Copy link
Member

misl6 commented Feb 13, 2023

The platform used to cross-compile the package should not change the result.
This is definitely a bug and needs to be addressed. Thank you @tytgatlieven and @robgar2001 for the investigation.

Do you have a full log to share with me?

@tytgatlieven
Copy link

tytgatlieven commented Feb 13, 2023

Dear

We have been investigating the issue and believe we have found the cause.
The only difference between a working and non-working build was in the host package ccache. The build does not work when ccache is installed.
In the build chain it is automatically included if found (there are ccache flags in cxxflags if I remember correctly. @robgar2001 ?)

Hence indeed, there is host library leakage into the build chain. I have not dug any deeper into why ccache does this, nor how to solve it.
@robgar2001: could you add the build log?
Hope this helps you forward.

@robgar2001
Copy link

Hi all,

These are the build logs:

native_build_(works).log
docker_build_(does not work).log

The docker_build log file was a build from scratch, all cache was removed beforehand (all .buildozer folders in both directories).
After that a buildozer clean was ran and the native build was started.
Some extra print info is found in the log files, this was just used by us to analyse how the code works and what arguments where being used in the build.

By searching in the log files for "environment matplotlib recipe" all the flags of the matplotlib recipe are found. It was noticed by us that ccache was not present in the working build on my native system. After removing the ccache package from the dockerfile the docker build also worked fine.

Don't hesitate to ask for further information.

With kind regards,

robgar2001

@Mahyarasadi
Copy link

Thanks, I had the same issue on the following system and it is working fine after uninstalling ccache
Linux: WSL2 Ubuntu 22.04.2 LTS
Python: 3.10.6
Matplotlib: 3.7.1
Kivy: 2.1.1

@isa5456
Copy link

isa5456 commented Sep 8, 2023

Some extra print info is found in the log files, this was just used by us to analyse how the code works and what arguments where being used in the build.

And if I'm not using dockerfile, but I have the same error. What can I do?

@isa5456
Copy link

isa5456 commented Sep 8, 2023

Thanks, I had the same issue on the following system and it is working fine after uninstalling ccache Linux: WSL2 Ubuntu 22.04.2 LTS Python: 3.10.6 Matplotlib: 3.7.1 Kivy: 2.1.1

But Uninstalling cache gives me an error when I build the app

@misl6
Copy link
Member

misl6 commented May 9, 2024

As matplotlib recipe has been updated, can you please check if this issue is still reproducible with python-for-android develop version?

Copy link

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Kivy's Control Tower Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests