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" error with API level 21 and 22 on 64-bit devices #228

Closed
ghost opened this issue Feb 29, 2020 · 6 comments
Closed

"dlopen failed" error with API level 21 and 22 on 64-bit devices #228

ghost opened this issue Feb 29, 2020 · 6 comments
Labels

Comments

@ghost
Copy link

@ghost ghost commented Feb 29, 2020

Complaining that libjpeg_chaquopy.so is not found when importing opencv-contrib-python on android api 22

02-29 10:45:37.900 14467-14467/? I/art: Late-enabling -Xcheck:jni
02-29 10:45:37.990 14467-14467/com.heyi.testing W/linker: Unsupported flags DT_FLAGS_1=0x8
02-29 10:45:37.990 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libcrypto_chaquopy.so: unused DT entry: type 0x6ffffffe arg 0x3aba0
02-29 10:45:37.990 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libcrypto_chaquopy.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: Unsupported flags DT_FLAGS_1=0x8
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libssl_chaquopy.so: unused DT entry: type 0x6ffffffe arg 0xc518
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libssl_chaquopy.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libsqlite3_chaquopy.so: unused DT entry: type 0x6ffffffe arg 0x40e0
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libsqlite3_chaquopy.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libpython3.8.so: unused DT entry: type 0x6ffffffe arg 0x1ce90
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libpython3.8.so: unused DT entry: type 0x6fffffff arg 0x3
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libchaquopy_java.so: unused DT entry: type 0x6ffffffe arg 0x2688
02-29 10:45:38.000 14467-14467/com.heyi.testing W/linker: /data/app/com.heyi.testing-1/lib/arm64/libchaquopy_java.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.050 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/zlib.so: unused DT entry: type 0x6ffffffe arg 0xef8
02-29 10:45:38.050 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/zlib.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.140 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/java/chaquopy.so: unused DT entry: type 0x6ffffffe arg 0x2fd0
02-29 10:45:38.150 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/java/chaquopy.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.160 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_struct.so: unused DT entry: type 0x6ffffffe arg 0x12b8
02-29 10:45:38.160 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_struct.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.230 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/binascii.so: unused DT entry: type 0x6ffffffe arg 0xb00
02-29 10:45:38.230 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/binascii.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.240 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_hashlib.so: unused DT entry: type 0x6ffffffe arg 0x1340
02-29 10:45:38.240 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_hashlib.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.270 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_ctypes.so: unused DT entry: type 0x6ffffffe arg 0x36b0
02-29 10:45:38.270 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_ctypes.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.360 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/math.so: unused DT entry: type 0x6ffffffe arg 0x14a0
02-29 10:45:38.360 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/math.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.370 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_datetime.so: unused DT entry: type 0x6ffffffe arg 0x16e8
02-29 10:45:38.370 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_datetime.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:38.380 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_csv.so: unused DT entry: type 0x6ffffffe arg 0xe68
02-29 10:45:38.380 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/_csv.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.500 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/mmap.so: unused DT entry: type 0x6ffffffe arg 0xf10
02-29 10:45:38.500 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/mmap.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.610 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/java/chaquopy_android.so: unused DT entry: type 0x6ffffffe arg 0x1a90
02-29 10:45:38.610 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/bootstrap-native/arm64-v8a/java/chaquopy_android.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.740 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/pyexpat.so: unused DT entry: type 0x6ffffffe arg 0x27b8
02-29 10:45:38.740 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/pyexpat.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.790 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_sha512.so: unused DT entry: type 0x6ffffffe arg 0x788
02-29 10:45:38.790 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_sha512.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.800 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_random.so: unused DT entry: type 0x6ffffffe arg 0xaf0
02-29 10:45:38.800 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_random.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.810 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_socket.so: unused DT entry: type 0x6ffffffe arg 0x1d68
02-29 10:45:38.810 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_socket.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:38.820 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/select.so: unused DT entry: type 0x6ffffffe arg 0x10b0
02-29 10:45:38.820 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/select.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:39.060 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_blake2.so: unused DT entry: type 0x6ffffffe arg 0xe48
02-29 10:45:39.060 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_blake2.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:39.070 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_sha3.so: unused DT entry: type 0x6ffffffe arg 0x1200
02-29 10:45:39.070 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_sha3.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:39.080 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_posixsubprocess.so: unused DT entry: type 0x6ffffffe arg 0xc50
02-29 10:45:39.080 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/stdlib-arm64-v8a/_posixsubprocess.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:39.130 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libjpeg_chaquopy.so: unused DT entry: type 0x6ffffffe arg 0x1f70
02-29 10:45:39.130 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libjpeg_chaquopy.so: unused DT entry: type 0x6fffffff arg 0x1
02-29 10:45:39.140 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libpng16.so: unused DT entry: type 0x6ffffffe arg 0x3c18
02-29 10:45:39.140 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libpng16.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:39.150 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libc++_shared.so: unused DT entry: type 0x6ffffffe arg 0x2eb68
02-29 10:45:39.150 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/chaquopy/lib/libc++_shared.so: unused DT entry: type 0x6fffffff arg 0x2
02-29 10:45:39.150 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/cv2/cv2.so: unused DT entry: type 0x6ffffffe arg 0x90b8
02-29 10:45:39.150 14467-14467/com.heyi.testing W/linker: /data/data/com.heyi.testing/files/chaquopy/AssetFinder/requirements/cv2/cv2.so: unused DT entry: type 0x6fffffff arg 0x5
02-29 10:45:39.180 14467-14467/com.heyi.testing D/AndroidRuntime: Shutting down VM
02-29 10:45:39.180 14467-14467/com.heyi.testing E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.heyi.testing, PID: 14467
    java.lang.RuntimeException: Unable to create application com.heyi.testing.app.AppLication: com.chaquo.python.PyException: ImportError: dlopen failed: library "libjpeg_chaquopy.so" not found
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4572)
        at android.app.ActivityThread.access$1500(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5275)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)
     Caused by: com.chaquo.python.PyException: ImportError: dlopen failed: library "libjpeg_chaquopy.so" not found
        at <python>.java.android.importer.create_module(importer.py:443)
        at <python>.java.chaquopy.import_override(import.pxi:20)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.cv2.<module>(__init__.py:3)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.airtest.aircv.aircv.<module>(aircv.py:5)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.airtest.aircv.<module>(__init__.py:1)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.airtest.core.cv.<module>(cv.py:13)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.airtest.core.api.<module>(api.py:10)
        at <python>.java.chaquopy.import_override(import.pxi:60)
        at <python>.init_device.<module>(init_device.py:1)
        at <python>.importlib._bootstrap._call_with_frames_removed(<frozen importlib._bootstrap>:219)
        at <python>.importlib._bootstrap_external.exec_module(<frozen importlib._bootstrap_external>:783)
        at <python>.java.android.importer.exec_module(importer.py:426)
        at <python>.importlib._bootstrap._load_unlocked(<frozen importlib._bootstrap>:671)
        at <python>.importlib._bootstrap._find_and_load_unlocked(<frozen importlib._bootstrap>:975)
        at <python>.importlib._bootstrap._find_and_load(<frozen importlib._bootstrap>:991)
        at <python>.importlib._bootstrap._gcd_import(<frozen importlib._bootstrap>:1014)
        at <python>.importlib.import_module(__init__.py:127)
        at <python>.chaquopy_java.Java_com_chaquo_python_Python_getModule(chaquopy_java.pyx:145)
        at com.chaquo.python.Python.getModule(Native Method)
        at com.heyi.testing.app.AppLication.onCreate(AppLication.java:45)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4569)
        at android.app.ActivityThread.access$1500(ActivityThread.java:154) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5275) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705) 
02-29 10:45:40.690 14467-14467/com.heyi.testing I/Process: Sending signal. PID: 14467 SIG: 9
@mhsmith
Copy link
Member

@mhsmith mhsmith commented Feb 29, 2020

  • What version of Chaquopy are you using?
  • What version of opencv-contrib-python?
  • What device are you using?
  • Does the problem occur on any other devices or emulators?

@ghost
Copy link
Author

@ghost ghost commented Mar 1, 2020

Sorry, I forgot to provide this information

The version I used is as follows:

chaquopy version: 7.0
opencv-contrib-python: 3.4.2.16-3

List of devices with problems:
Real device:
mi-4c android 5.1.1
Virtual device:
android API 22 x86_64 without google apis
and
android API 22 x86_64 with google apis

Emulators are created using the latest version of the image in android studio

@ghost
Copy link
Author

@ghost ghost commented Mar 1, 2020

No problem with the same apk on api 24 and above.

What is the minimum api version supported by chaquopy 7.0,
I only saw from the official website that chaquopy 6.3.0 has a minimum support of api16.

@mhsmith
Copy link
Member

@mhsmith mhsmith commented Mar 1, 2020

Thanks for the information. The minimum API level for chaquopy 7.0 is still 16. However, it looks like we have a problem loading native libraries in 64-bit processes before API 23. Android added 64-bit support in API 21, so 21 and 22 are the only ones affected.

You can work around this bug by removing the 64-bit ABI from your build.gradle file. However, Google Play now requires 64-bit support, so in order to release your app there you'd have to build multiple APKs and set the 64-bit APK's minSdkVersion to 23.

On an emulator, you can also work around it by using an x86 image rather than x86_64.

@mhsmith mhsmith added the bug label Mar 1, 2020
@mhsmith mhsmith changed the title on api 22 libjpeg_chaquopy.so not found "dlopen failed" error with API level 21 and 22 on 64-bit devices Mar 1, 2020
@ghost
Copy link
Author

@ghost ghost commented Mar 2, 2020

Thanks for your help, the problem has been solved after removing the 64-bit support

@mhsmith
Copy link
Member

@mhsmith mhsmith commented May 11, 2020

This issue is fixed in Chaquopy version 7.0.3. All packages now work on 64-bit ABIs as far back as API level 21, except for TensorFlow, which gives the following error:

tensorflow.python.framework.errors_impl.NotFoundError: dlopen failed: library name "/data/data/com.chaquo.python.pkgtest3/files/chaquopy/AssetFinder/requirements/tensorflow_core/lite/experimental/microfrontend/python/ops/_audio_microfrontend_op.so" too long

We'll fix this the next time we upgrade TensorFlow (#374).

@mhsmith mhsmith closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant