You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of this, I'm facing a runtime issue while loading spaCy.
File "/data/user/0/com.example/assets/python/scripts/test.py", line 4, in <module>from spacy import LanguageFile "/p4a/build/python-installs/unnamed_dist_1/arm64-v8a/spacy/__init__.py", line 11, in <module>File "/p4a/build/python-installs/unnamed_dist_1/arm64-v8a/thinc/api.py", line 2, in <module>File "/p4a/build/python-installs/unnamed_dist_1/arm64-v8a/thinc/initializers.py", line 4, in <module>File "/p4a/build/python-installs/unnamed_dist_1/arm64-v8a/thinc/backends/__init__.py", line 7, in <module>File "/p4a/build/python-installs/unnamed_dist_1/arm64-v8a/thinc/backends/ops.py", line 15, in <module>ImportError: dlopen failed: cannot locate symbol "_ZNKSt6__ndk119__shared_weak_count13__get_deleterERKSt9type_info" referenced by "/data/data/com.example/assets/python/site-packages/thinc/backends/cblas.so"...
At first I've tried to just extend these recipes from the CppCompiledComponentsPythonRecipe, since I expected it to reference the STL correctly.
classCppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
""" Extensions that require the cxx-stl """call_hostpython_via_targetpython=Falseneed_stl_shared=True
But then thinc compilation failed with Something's broken. UCHAR_MAX should be defined in limits.h. and some other errors related to unexpected platform char size, etc. I bet it is occurred because of conflicting headers from both C stdlib and C++ STL.
So, then I've tried to override the CppCompiledComponentsPythonRecipe behaviour by removing the includes from compiler flags, but leaving linker flags as-is. Now it compiles fine, but libc++_shared.so is still not included in .so dependencies.
Right now I can fix that simply by patching all .so files in spacy & thinc folders under site-packages using
Any other suggestions on improving the quality of recipes are also appreciated in the separate issues! I hope to create a PR with these recipes in the main P4A repository in the future.
libc++_shared.so
is not added to theNEEDED
section of spacy & thinc's.so
libraries.Because of this, I'm facing a runtime issue while loading spaCy.
At first I've tried to just extend these recipes from the
CppCompiledComponentsPythonRecipe
, since I expected it to reference the STL correctly.https://github.com/kivy/python-for-android/blob/f7f8cea636714dc4843b8818c553510f99084b6a/pythonforandroid/recipe.py#L1042-L1045
But then thinc compilation failed with
Something's broken. UCHAR_MAX should be defined in limits.h.
and some other errors related to unexpected platform char size, etc. I bet it is occurred because of conflicting headers from both C stdlib and C++ STL.So, then I've tried to override the
CppCompiledComponentsPythonRecipe
behaviour by removing the includes from compiler flags, but leaving linker flags as-is. Now it compiles fine, butlibc++_shared.so
is still not included in.so
dependencies.Right now I can fix that simply by patching all
.so
files in spacy & thinc folders undersite-packages
using$ find . -type f -name '*.so' -exec patchelf --add-needed libc++_shared.so {} \;
And everything runs just fine.
But I need to figure out how to properly link libc++_shared.so in the corresponding p4a recipes:
p4a-recipes/thinc/__init__.py
Lines 4 to 44 in d343779
p4a-recipes/spacy/__init__.py
Lines 4 to 56 in d343779
The text was updated successfully, but these errors were encountered: