mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Build android example handtrackinggpu Failed But build android helloworld success on Mac

Open KaihangHe opened this issue 3 years ago • 5 comments

Please make sure that this is a bug and also refer to the troubleshooting, FAQ documentation before raising any issues.

System information (Please provide as much relevant information as possible)

  • Have I written custom code (as opposed to using a stock example script provided in MediaPipe): no

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): macOS Monterey 12.5 (x64)

  • MediaPipe version: v0.8.10.2

  • Bazel version (if compiling from source): 5.2.0

  • Solution ( e.g. FaceMesh, Pose, Holistic ): All Mediapipe Android Example, but basic:helloworld is ok.

  • Android Studio, NDK, SDK versions (if issue is related to building in Android environment): Android SDK 30, NDK 21.4.7075529

Describe the current behavior: I was following these steps to build mediapipe android example https://google.github.io/mediapipe/getting_started/hello_world_android.html But failed to build handtrackinggpu at the end. I had tried the bazel clean --expunge but it doesn't work. Describe the expected behavior: when executable bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/basic:helloworld,it success to compile a apk, but when executable bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu bazel give a error as

xxx@T1xxx ~/mediapipe (master)> bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /private/var/tmp/_bazel_kaihanghe/ef470f9ba6e414ec71755c4ec76c8c75/external/org_tensorflow/third_party/repo.bzl:124:14:
Warning: skipping import of repository 'pybind11' because it already exists.
WARNING: /Users/kaihanghe/mediapipe/mediapipe/framework/BUILD:54:24: in cc_library rule //mediapipe/framework:calculator_cc_proto: target '//mediapipe/framework:calculator_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use.
ERROR: /Users/kaihanghe/mediapipe/mediapipe/gpu/BUILD:375:13: in objc_library rule //mediapipe/gpu:pixel_buffer_pool_util: Expected action_config for 'objc++-compile' to be configured
ERROR: /Users/kaihanghe/mediapipe/mediapipe/gpu/BUILD:375:13: in objc_library rule //mediapipe/gpu:pixel_buffer_pool_util:
Traceback (most recent call last):
	File "/virtual_builtins_bzl/common/objc/objc_library.bzl", line 127, column 124, in _objc_library_impl
	File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 316, column 50, in _register_compile_and_archive_actions
	File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 394, column 66, in _cc_compile_and_link
	File "/virtual_builtins_bzl/common/objc/compilation_support.bzl", line 193, column 29, in _compile
Error in compile: Expected action_config for 'objc++-compile' to be configured
ERROR: /Users/kaihanghe/mediapipe/mediapipe/gpu/BUILD:375:13: Analysis of target '//mediapipe/gpu:pixel_buffer_pool_util' failed
ERROR: Analysis of target '//mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu' failed; build aborted:
INFO: Elapsed time: 0.556s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 1199 targets configured)

Standalone code to reproduce the issue: Provide a reproducible test case that is the bare minimum necessary to replicate the problem. If possible, please share a link to Colab/repo link /any notebook:

Other info / Complete Logs : Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached

KaihangHe avatar Aug 08 '22 08:08 KaihangHe

Hi @KaihangHe, Could you please confirm the version of Xcode installed to build the MediaPipe as mentioned here in official documentation. Thank you!

kuaashish avatar Aug 08 '22 11:08 kuaashish

Hi @KaihangHe, Could you please confirm the version of Xcode installed to build the MediaPipe as mentioned here in official documentation. Thank you!

my xcode version "Xcode 14 Βeta 4", the "Command_Line_Tools_for_Xcode_14_beta_4.dmg" download from https://developer.apple.com/download/more/

Thank you for your help!

KaihangHe avatar Aug 08 '22 14:08 KaihangHe

Hi @KaihangHe, It looks like the issue is more related bazel cross tools. Please refer to this issue for more information. Thank you!

kuaashish avatar Aug 09 '22 05:08 kuaashish

Hi @KaihangHe, It looks like the issue is more related bazel cross tools. Please refer to this issue for more information. Thank you!

Hi @kuaashish , According to this,I had tried to reinstall bazel by Installing using the binary installer, then executable bazel clean --expunge and bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu or bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu --macos_cpus x86_64, but both them cant work.

when I tried the bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu --define MEDIAPIPE_DISABLE_GPU=1 Build is successful but after installation I get runtime error on android device.

there is log on android device when try to run the Hand tracking apk:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'xiaomi/wayne/wayne:9/PKQ1.180904.001/9.9.3:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 19319, tid: 19319, name: handtrackinggpu  >>> com.google.mediapipe.apps.handtrackinggpu <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    x0  0000000000000000  x1  0000000000004b77  x2  0000000000000006  x3  0000000000000008
    x4  3038303232303246  x5  3038303232303246  x6  3038303232303246  x7  3a39303a34312039
    x8  0000000000000083  x9  2f9ff9f360eec461  x10 0000000000000000  x11 fffffffc7ffffbdf
    x12 0000000000000001  x13 6562207361682074  x14 0000007ff4ac75d0  x15 0000000000000001
    x16 0000007f7b3e02b0  x17 0000007f7b2ffcd0  x18 0000000000000010  x19 0000000000004b77
    x20 0000000000004b77  x21 0000007edd9eea54  x22 0000007f7b3e2290  x23 0000007edd9df9d2
    x24 0000007f7e4145e0  x25 0000007f7e4145e0  x26 0000000000000021  x27 0000000000000000
    x28 0000000000000007  x29 0000007ff4ac7ee0
    sp  0000007ff4ac7ea0  lr  0000007f7b2f3144  pc  0000007f7b2f316c

backtrace:
    #00 pc 000000000002216c  /system/lib64/libc.so (abort+116)
    #01 pc 00000000008dbd10  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (google::logging_fail()+8)
    #02 pc 00000000008db3f8  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (google::LogMessage::SendToLog()+1036)
    #03 pc 00000000008db988  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (google::LogMessage::Flush()+228)
    #04 pc 00000000008ded9c  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (google::LogMessageFatal::~LogMessageFatal()+16)
    #05 pc 00000000007ee7f8  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (mediapipe::android::Graph::SetParentGlContext(long)+56)
    #06 pc 00000000007f2db0  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/lib/arm64/libmediapipe_jni.so (Java_com_google_mediapipe_framework_Graph_nativeSetParentGlContext+44)
    #07 pc 000000000001df3c  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.odex (offset 0x1d000) (com.google.mediapipe.framework.Graph.nativeSetParentGlContext [DEDUPED]+140)
    #08 pc 0000000000557388  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #09 pc 00000000000cfcc8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #10 pc 0000000000280338  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
    #11 pc 000000000027a34c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
    #12 pc 0000000000527804  /system/lib64/libart.so (MterpInvokeDirect+296)
    #13 pc 0000000000549a14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
    #14 pc 00000000002f0ff8  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.vdex (com.google.mediapipe.framework.Graph.setParentGlContext+52)
    #15 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3375396565+488)
    #16 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
    #17 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
    #18 pc 0000000000529508  /system/lib64/libart.so (MterpInvokeVirtualQuick+584)
    #19 pc 000000000054d694  /system/lib64/libart.so (ExecuteMterpImpl+29972)
    #20 pc 00000000003fd4ac  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.vdex (com.google.mediapipe.components.FrameProcessor.addVideoStreams+12)
    #21 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3375396565+488)
    #22 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
    #23 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
    #24 pc 0000000000529508  /system/lib64/libart.so (MterpInvokeVirtualQuick+584)
    #25 pc 000000000054d694  /system/lib64/libart.so (ExecuteMterpImpl+29972)
    #26 pc 00000000003fd116  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.vdex (com.google.mediapipe.components.FrameProcessor.<init>+66)
    #27 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3375396565+488)
    #28 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
    #29 pc 000000000027b450  /system/lib64/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+720)
    #30 pc 0000000000529038  /system/lib64/libart.so (MterpInvokeDirectRange+244)
    #31 pc 0000000000549d14  /system/lib64/libart.so (ExecuteMterpImpl+15252)
    #32 pc 0000000000468020  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.vdex (com.google.mediapipe.apps.basic.MainActivity.onCreate+172)
    #33 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3375396565+488)
    #34 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
    #35 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
    #36 pc 0000000000526b5c  /system/lib64/libart.so (MterpInvokeSuper+1420)
    #37 pc 0000000000549994  /system/lib64/libart.so (ExecuteMterpImpl+14356)
    #38 pc 0000000000469cd6  /data/app/com.google.mediapipe.apps.handtrackinggpu-W7r8p3VJQo9PJfRN1u016A==/oat/arm64/base.vdex (com.google.mediapipe.apps.handtrackinggpu.MainActivity.onCreate+2)
    #39 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3375396565+488)
    #40 pc 0000000000516d78  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
    #41 pc 00000000005604fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
    #42 pc 000000000162d394  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.Activity.performCreate+196)
    #43 pc 0000000000aaa9f0  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.Instrumentation.callActivityOnCreate+80)
    #44 pc 0000000000f352f0  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.ActivityThread.performLaunchActivity+2112)
    #45 pc 0000000000f3c1b8  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.ActivityThread.handleLaunchActivity+424)
    #46 pc 000000000165c874  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.servertransaction.LaunchActivityItem.execute+372)
    #47 pc 0000000000b22c34  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.servertransaction.TransactionExecutor.executeCallbacks+708)
    #48 pc 0000000000b228f8  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.servertransaction.TransactionExecutor.execute+280)
    #49 pc 0000000000f1f6a4  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.ActivityThread$H.handleMessage+340)
    #50 pc 00000000017aa1f4  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.os.Handler.dispatchMessage+180)
    #51 pc 0000000001f90e18  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.os.Looper.loop+1304)
    #52 pc 0000000000f33d48  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (android.app.ActivityThread.main+664)
    #53 pc 000000000055764c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
    #54 pc 00000000000cfce8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
    #55 pc 000000000045dd78  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
    #56 pc 000000000045f7cc  /system/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1440)
    #57 pc 00000000003ef398  /system/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
    #58 pc 000000000078eed4  /system/framework/arm64/boot-core-oj.oat (offset 0x2dc000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+180)
    #59 pc 000000000248c6e8  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+136)
    #60 pc 00000000024a55d8  /system/framework/arm64/boot-framework.oat (offset 0xa4e000) (com.android.internal.os.ZygoteInit.main+2104)
    #61 pc 000000000055764c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
    #62 pc 00000000000cfce8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
    #63 pc 000000000045dd78  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
    #64 pc 000000000045d9d8  /system/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+424)
    #65 pc 0000000000362cd8  /system/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+652)
    #66 pc 00000000000b3d00  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116)
    #67 pc 00000000000b689c  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+924)
    #68 pc 0000000000002528  /system/bin/app_process64 (main+2012)
    #69 pc 00000000000c9270  /system/lib64/libc.so (__libc_init+88)

Thanks for your patience!

KaihangHe avatar Aug 09 '22 06:08 KaihangHe

Hi @KaihangHe, Could you share the Android Device configuration to look into the issue further. Thank you!

kuaashish avatar Aug 09 '22 07:08 kuaashish

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Aug 16 '22 08:08 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Aug 23 '22 09:08 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Aug 23 '22 09:08 google-ml-butler[bot]