Ubuntu下编译mediapipe_生成Android环境的apk

参考

MediaPipe的编译与测试_Linda Fan的博客-CSDN博客

Ubuntu上构建Android的MediaPipe_吃骨头不吐股骨头皮的博客-CSDN博客

根据setup_android_sdk_and_ndk.sh,安装SDK、NDK

最后编译的时候出现错误

ERROR: /home/user/.cache/bazel/_bazel_djgv4b/01070679540b3cf481bcf4a10240c48d/external/XNNPACK/BUILD.bazel:7951:19: Compiling src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c failed: (Exit 1): clang failed: error executing command external/androidndk/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -gcc-toolchain external/androidndk/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -target ... (remaining 86 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:77:16: error: assigning to 'uint32x2_t' (vector of 2 'uint32_t' values) from incompatible type 'int'
        vnacc0 = vdot_u32(vnacc0, va_zero_point, va0x01234567);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:78:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x0123 = vdotq_lane_u32(vpacc0x0123, vb0123x0123, va0x01234567, 0);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:79:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x4567 = vdotq_lane_u32(vpacc0x4567, vb0123x4567, va0x01234567, 0);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:80:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x0123 = vdotq_lane_u32(vpacc0x0123, vb4567x0123, va0x01234567, 1);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:81:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x4567 = vdotq_lane_u32(vpacc0x4567, vb4567x4567, va0x01234567, 1);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:95:16: error: assigning to 'uint32x2_t' (vector of 2 'uint32_t' values) from incompatible type 'int'
        vnacc0 = vdot_u32(vnacc0, va_zero_point, va0x01234567);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:96:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x0123 = vdotq_lane_u32(vpacc0x0123, vb0123x0123, va0x01234567, 0);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/XNNPACK/src/qu8-igemm/gen/1x8c4-minmax-rndnu-neondot.c:97:21: error: assigning to 'uint32x4_t' (vector of 4 'uint32_t' values) from incompatible type 'int'
        vpacc0x4567 = vdotq_lane_u32(vpacc0x4567, vb0123x4567, va0x01234567, 0);
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 errors generated.
Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/facedetectioncpu:facedetectioncpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 19.804s, Critical Path: 11.25s
INFO: 395 processes: 146 internal, 249 linux-sandbox.
FAILED: Build did NOT complete successfully
(base) djgv4b:~/DXY/MP_Project/mediapipe$ 

初步判断为NDK版本的问题

根据参考1的解决方案,将ndk进行升级,从r18b升级到r21e

把sudo gedit /etc/profile中r18b,改为r21e

把WORKSPACE的android_sdk_repository中的r18b,改为r21e

再次尝试编译,成功

facedetectioncpu

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/facedetectioncpu:facedetectioncpu
#生成facedetectioncpu.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/facedetectioncpu/facedetectioncpu.apk

objectdetectioncpu

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectioncpu:objectdetectioncpu
#生成objectdetectioncpu.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetectioncpu/objectdetectioncpu.apk

faceeffect

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/faceeffect:faceeffect
#生成faceeffect.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/faceeffect/faceeffect.apk

objectdetection3d

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetection3d:objectdetection3d
#生成objectdetection3d.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/objectdetection3d/objectdetection3d.apk

instantmotiontracking

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/instantmotiontracking:instantmotiontracking
#生成instantmotiontracking.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/instantmotiontracking/instantmotiontracking.apk

templatematchingcpu

bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/templatematchingcpu:templatematchingcpu
#生成templatematchingcpu.apk的位置
bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/templatematchingcpu/templatematchingcpu.apk

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值