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

rust recipe shazamio-core, builds fine, but cannot locate symbol __gxx_personality_v0 #3030

Open
5 tasks done
magowiz opened this issue Jun 8, 2024 · 7 comments
Open
5 tasks done

Comments

@magowiz
Copy link

magowiz commented Jun 8, 2024

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.10
  • OS: Ubuntu 22.04
  • Kivy: 2.3.1
  • Cython: 0.29.33
  • OpenJDK: 17

Description

I was trying to add to my project a shazamio-core recipe which is a rust project, so I used the recipe class RustCompiledComponentsRecipe and wrote my own recipe, which is this:

from pythonforandroid.recipe import RustCompiledComponentsRecipe


class ShazamIoCoreRecipe(RustCompiledComponentsRecipe):
    version = "1.0.7"
    url = (
        f"https://github.com/shazamio/shazamio-core/archive/refs/tags/{version}.tar.gz"
    )
    site_packages = "shazamio_core"


recipe = ShazamIoCoreRecipe()

It compiles fine, but in android, when I launch my app I get this import error:

ImportError: dlopen failed: cannot locate symbol "__gxx_personality_v0" referenced by "/data/data/net.magowiz.musenote/files/app/_python_bundle/site-packages/shazamio_core/shazamio_core.so"...

then the app crashes

buildozer.spec

Command:

buildozer android debug

Spec file:

title = MuseNote
package.name = musenote
package.domain = net.magowiz
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
source.exclude_dirs = tests, bin, venv, source
version = 0.1
requirements = python3,kivy,kivymd,androidstorage4kivy,bawx-player,mutagen,ffpyplayer==v4.5.1,ffpyplayer_codecs,ffmpeg,
    sqlalchemy,alembic,typing_extensions,mako,markupsafe,pydantic,dataclass_factory,aiohttp_retry,aiohttp,multidict,
    attrs,yarl,async_timeout,charset_normalizer==2.1.1,faust-cchardet,aiosignal,frozenlist,pydub,shazamio_core,annotated_types,
    https://github.com/andreyzin/ShazamIO/archive/refs/heads/bump-pydantic2.zip,pydantic-core
presplash.filename = %(source.dir)s/img/icon.png
icon.filename = %(source.dir)s/img/icon.png
orientation = portrait, landscape
osx.python_version = 3
osx.kivy_version = 1.9.1
fullscreen = 0
android.permissions = STORAGE, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, INTERNET,MANAGE_EXTERNAL_STORAGE,READ_MEDIA_IMAGES,READ_MEDIA_VIDEO,READ_MEDIA_AUDIO
android.api = 34
android.archs = arm64-v8a, armeabi-v7a, x86, x86_64
android.allow_backup = True
p4a.fork = kivy
p4a.branch = develop
p4a.local_recipes = p4a_recipes
ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.10.0
ios.codesign.allowed = false
[buildozer]
log_level = 2
warn_on_root = 0

Logs

no errors on building

@T-Dynamos
Copy link
Contributor

T-Dynamos commented Jun 8, 2024

Maybe you try to play with linking flags in get_recipe_env and add -lstdc++.

Something like:

    def get_recipe_env(self, arch, **kwargs):
        env = super().get_recipe_env(arch, **kwargs)
        env['LDFLAGS'] += ' -lstdc++'
        return env

@magowiz
Copy link
Author

magowiz commented Jun 8, 2024

Hi @T-Dynamos,
thanks for the hint, I changed the recipe in this way, like you suggested:

from pythonforandroid.recipe import RustCompiledComponentsRecipe


class ShazamIoCoreRecipe(RustCompiledComponentsRecipe):
    version = "1.0.7"
    url = (
        f"https://github.com/shazamio/shazamio-core/archive/refs/tags/{version}.tar.gz"
    )
    site_packages = "shazamio_core"

    def get_recipe_env(self, arch, **kwargs):
        env = super().get_recipe_env(arch, **kwargs)
        env['LDFLAGS'] += ' -lstdc++'
        return env


recipe = ShazamIoCoreRecipe()

I deleted buildozer home and build folders and built again, with new recipe, it builds successfully, but I still get same behavior: app crashes and on log there is same error.

@magowiz
Copy link
Author

magowiz commented Jun 11, 2024

Hi,
mantainer provided in a release in github some whl files https://github.com/shazamio/shazamio-core/releases , for example this: https://github.com/shazamio/shazamio-core/releases/download/1.0.7/shazamio_core-1.0.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

How can I create a recipe that install from there ?

@T-Dynamos
Copy link
Contributor

T-Dynamos commented Jun 11, 2024

@magowiz This can't be used, as it's compiled for glibc, but android is bionic.

(Only wheels compiled with android-ndk will work)

@T-Dynamos
Copy link
Contributor

I believe this error can be easily solved, I will try work on it ASAP.

@magowiz
Copy link
Author

magowiz commented Jun 11, 2024

thank you very much!

@magowiz
Copy link
Author

magowiz commented Jun 29, 2024

I believe this error can be easily solved, I will try work on it ASAP.

Hi, is there news about it?

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

No branches or pull requests

2 participants