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

加载模型的时候报错 #26

Open
privateQzk opened this issue Jul 10, 2023 · 11 comments
Open

加载模型的时候报错 #26

privateQzk opened this issue Jul 10, 2023 · 11 comments

Comments

@privateQzk
Copy link

加载模型的时候报错E/paddle: onFaildlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~vUQmPS6cgjFaV3KC29OdGQ==/car.bkrc.com.car2022-xjIkcZuxy6z3jSDntEFL7A==/base.apk!/lib/armeabi-v7a/libpaddle_full_api_shared.so"...这是什么问题呢

@equationl
Copy link
Owner

你好,请问是运行 demo 报错还是集成到您的项目中报错?

如果是集成到您的项目中报错,方便提供一下最下复现 demo 吗?

@viclm
Copy link

viclm commented Jul 17, 2024

同问,集成到项目运行到arm64的手机上报错,本地模拟器没问题

@equationl
Copy link
Owner

@viclm 报错信息是什么

@viclm
Copy link

viclm commented Jul 22, 2024

034-4598 imgdec pid-4034 I OCRVersionString 1.6.5.22
2024-07-22 09:49:31.717 6513-6513 PaddleOCRPlugin uni.liuming.demo E 模型加载失败: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~aVc-MZsPlomRkdbRkPvBfA==/uni.liuming.demo-ssl4xw1jXF8pIn6_YeeHWQ==/lib/arm64/libpaddle_full_api_shared.so"...
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~aVc-MZsPlomRkdbRkPvBfA==/uni.liuming.demo-ssl4xw1jXF8pIn6_YeeHWQ==/lib/arm64/libpaddle_full_api_shared.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.baidu.paddle.fastdeploy.FastDeployInitializer.init(FastDeployInitializer.java:19)
at com.baidu.paddle.fastdeploy.pipeline.PPOCRBase.(PPOCRBase.java:176)
at com.equationl.fastdeployocr.OCR.initModel(OCR.kt:240)
at com.equationl.fastdeployocr.OCR.initModelSync-IoAF18A(OCR.kt:79)
at com.equationl.fastdeployocr.OCR$initModel$1.invokeSuspend(OCR.kt:96)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

@viclm
Copy link

viclm commented Jul 22, 2024

安卓11报的错,安卓10没问题

@equationl
Copy link
Owner

@viclm
Copy link

viclm commented Jul 23, 2024

我指定了和你一样的 ndkVersion '21.1.6352462' 还是不行

@equationl
Copy link
Owner

方便的话你发一个最小复现 demo 完整的项目给我,我试一下

@equationl
Copy link
Owner

你这个不是原生安卓项目吧?

@viclm
Copy link

viclm commented Jul 24, 2024

https://github.com/viclm/UniPlugin-Hello-AS

下面的操作录屏文件

2024-07-24.15.48.37.-.Compressed.with.FlexClip.mp4

@equationl
Copy link
Owner

就是 NDK 版本兼容问题,因为这里是直接引用的 xx.so 文件而没有实时编译,所以你通过 ndkVersion '24.0.8215888' 指定 NDK 版本是没用的。

由于安卓特性,不能有同名文件,所以你在 gardle 脚本中使用了配置 pickFirst 'lib/arm64-v8a/libc++_shared.so' 这导致会优先使用 app 模块的文件而非其他模块文件,换句话说就是 paddlerocr 可用的 libc++_shared.so 被替换成了你的项目生成的 libc++_shared.so 文件,但是这个文件不兼容 paddleocr。

因此,你有两个解决办法:

  1. 修改你的项目构建选项,使其能够使用 paddleocr 的 libc++_shared.so 或 将你的项目编译生成的 libc++_shared.so 改为和 paddleocr 兼容的版本。
  2. 强制替换项目的 libc++_shared.so 为兼容的 libc++_shared.so 文件,如图:

image

下面这个视频是使用 方法2 修改后的效果:

Screen_recording_20240725_095018.mp4

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

3 participants