[问答]鸿蒙手机侧app开发加载so文件报错

阅读量0
0
0
想将histreaming.app代码移植到鸿蒙侧,发现在调用liblink_core.so文件时报错,请大佬帮忙解答一下,感谢

这个是CMakeLists.txt相关内容


这个是项目.so文件存放位置

编译时报错如下

> Task :entry:preBuild
FAILED: E:/project/Smartcar/entry/build/intermediates/cmake/debug/obj/arm64-v8a/libhello.so
cmd.exe /C "cd . && C:UserschenjiacAppDataLocalHuaweiSdknative2.0.1.93llvmbinclang++.exe --target=aarch64-linux-ohos --gcc-toolchain=C:/Users/chenjiac/AppData/Local/Huawei/Sdk/native/2.0.1.93/llvm --sysroot=C:/Users/chenjiac/AppData/Local/Huawei/Sdk/native/2.0.1.93/sysroot -fPIC -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  --rtlib=compiler-rt -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lunwind -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -shared -Wl,-soname,libhello.so -o E:projectSmartcarentrybuildintermediatescmakedebugobjarm64-v8alibhello.so CMakeFiles/hello.dir/hello.cpp.o CMakeFiles/hello.dir/jni_utils.c.o  -Wl,-rpath,E:/project/Smartcar/entry/src/main/cpp/../../../libs/arm64-v8a  E:/project/Smartcar/entry/src/main/cpp/../../../libs/arm64-v8a/liblink_core.so  -lm && cd ."
ld.lld: error: E:/project/Smartcar/entry/src/main/cpp/../../../libs/arm64-v8a/liblink_core.so is incompatible with aarch64linux
这里说liblink_core.so不兼容,不知道是不是这个so文件不支持arm64-v8a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Cmake thread
org.gradle.api.GradleException: native build cmake execute failed
at com.huawei.ohos.build.utils.ProcessUtils.processWait(ProcessUtils.groovy:104)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:90)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy)
at com.huawei.ohos.build.utils.ProcessUtils$execute$1.callCurrent(Unknown Source)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:66)
at com.huawei.ohos.build.utils.ProcessUtils$execute$0.callCurrent(Unknown Source)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:62)
at com.huawei.ohos.build.utils.ProcessUtils$execute.call(Unknown Source)
at com.huawei.ohos.build.dsl.CmakeThread.executeCmakeBuild(CmakeThread.groovy:106)
at com.huawei.ohos.build.dsl.CmakeThread.run(CmakeThread.groovy:58)
Exception in thread "Thread-2598" org.gradle.api.GradleException: native build cmake execute failed
at sun.reflect.GeneratedConstructorAccessor325.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:249)
at com.huawei.ohos.build.utils.ProcessUtils.processWait(ProcessUtils.groovy:104)
at sun.reflect.GeneratedMethodAccessor296.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:184)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:90)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy)
at com.huawei.ohos.build.utils.ProcessUtils$execute$1.callCurrent(Unknown Source)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:66)
at com.huawei.ohos.build.utils.ProcessUtils$execute$0.callCurrent(Unknown Source)
at com.huawei.ohos.build.utils.ProcessUtils.execute(ProcessUtils.groovy:62)
at com.huawei.ohos.build.utils.ProcessUtils$execute.call(Unknown Source)
at com.huawei.ohos.build.dsl.CmakeThread.executeCmakeBuild(CmakeThread.groovy:106)
at com.huawei.ohos.build.dsl.CmakeThread.run(CmakeThread.groovy:58)
> Task :entry:compileDebugNativeWithCmake FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':entry:compileDebugNativeWithCmake'.
> native build cmake execute failed

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 15s
2 actionable tasks: 2 executed


回帖

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容图片侵权或者其他问题,请联系本站作侵删。 侵权投诉
链接复制成功,分享给好友