google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.82k stars 5.18k forks source link

Binary Graph Build Bazel #4239

Closed jimwinkpresage closed 8 months ago

jimwinkpresage commented 1 year ago

OS Platform and Distribution

MacOS 12.4

Compiler version

No response

Programming Language and version

N/A

Installed using virtualenv? pip? Conda?(if python)

No response

MediaPipe version

Latest Master Branch as of 4/4/23

Bazel version

bazel 6.1.1-homebrew

XCode and Tulsi versions (if iOS)

No response

Android SDK and NDK versions (if android)

No response

Android AAR (if android)

None

OpenCV version (if running on desktop)

No response

Describe the problem

When running the following: 
bazel build -c opt mediapipe/graphs/face_detection:face_detection_mobile_gpu_binary_graph

Complete Logs

2 warnings generated.
ERROR: /Users/jimwinkelmann/mediapipe/mediapipe/graphs/face_detection/BUILD:63:23: Linking mediapipe/graphs/face_detection/face_detection_mobile_gpu_binary_graph_text_to_binary_graph [for tool] failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //mediapipe/graphs/face_detection:face_detection_mobile_gpu_binary_graph_text_to_binary_graph) external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/graphs/face_detection/face_detection_mobile_gpu_binary_graph_text_to_binary_graph-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
stderr (/private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/execroot/mediapipe/bazel-out/_tmp/actions/stderr-1520) 1872680 exceeds maximum size of --experimental_ui_max_stdouterr_bytes=1048576 bytes; skipping
Target //mediapipe/graphs/face_detection:face_detection_mobile_gpu_binary_graph failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 291.135s, Critical Path: 160.26s
INFO: 875 processes: 44 internal, 831 darwin-sandbox.
FAILED: Build did NOT complete successfully
jimwinkpresage commented 1 year ago

More color here. The following builds fine for the Helloworld basic app build: bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/basic:helloworld

I also can successfully build the graph with the edge_detection: bazel build -c opt --config=android_arm64 mediapipe/graphs/edge_detection:mobile_gpu_binary_graph

But no other graphs will build: bazel build -c opt --config=android_arm64 mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu

WARNING: /Users/jimwinkelmann/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. WARNING: /Users/jimwinkelmann/mediapipe/mediapipe/framework/tool/BUILD:197:24: in cc_library rule //mediapipe/framework/tool:field_data_cc_proto: target '//mediapipe/framework/tool:field_data_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use. INFO: Analyzed target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /Users/jimwinkelmann/mediapipe/mediapipe/graphs/hand_tracking/subgraphs/BUILD:42:26: Linking mediapipe/graphs/hand_tracking/subgraphs/hand_renderer_gpu_graph_text_to_binary_graph [for tool] failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //mediapipe/graphs/hand_tracking/subgraphs:hand_renderer_gpu_graph_text_to_binary_graph) (cd /private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/sandbox/darwin-sandbox/2095/execroot/mediapipe && \ exec env - \ APPLE_SDK_PLATFORM=MacOSX \ APPLE_SDK_VERSION_OVERRIDE=12.3 \ PATH=/Users/jimwinkelmann/opt/anaconda3/bin:/Users/jimwinkelmann/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin \ XCODE_VERSION_OVERRIDE=13.4.0.13F17a \ ZERO_AR_DATE=1 \ external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/graphs/hand_tracking/subgraphs/hand_renderer_gpu_graph_text_to_binary_graph-2.params)

Configuration: 3d7d60613c2d7f274cecf45f11c2317bf43b0482607a7603f501eeaa0bc3b25c

Execution platform: @local_execution_config_platform//:platform

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging stderr (/private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/execroot/mediapipe/bazel-out/_tmp/actions/stderr-15) 1460956 exceeds maximum size of --experimental_ui_max_stdouterr_bytes=1048576 bytes; skipping Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu failed to build INFO: Elapsed time: 6.779s, Critical Path: 6.54s INFO: 131 processes: 124 internal, 6 darwin-sandbox, 1 worker. FAILED: Build did NOT complete successfully

kuaashish commented 1 year ago

Hello @jimwinkpresage,

From our end, We could successfully reproduce the issue without any error in macOS 13.2.1 (22D68), Chip Apple M1 Pro, Android Studio Dolphin | 2021.3.1 Patch 1, Bazel 6.1.1-homebrew, Latest clone of Mediapipe 04/05/2023. Please try to upgrade to latest version of macOS 13.2.1 and let us know if the issue still persists. Attached the screenshot here of build process.

Issue

Thank you!

jimwinkpresage commented 1 year ago

Updated my OS and updated X-code and can build the hello world example. However I am still getting the same error with building any of the graphs except edge detection:

bazel build -c opt --config=android_arm64 mediapipe/graphs/object_detection:mobile_cpu_binary_graph --sandbox_debug

image

jimwinkpresage commented 1 year ago

when I run the command that is getting the error: (cd /private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/sandbox/darwin-sandbox/1249/execroot/mediapipe && \ exec env - \ APPLE_SDK_PLATFORM=MacOSX \ APPLE_SDK_VERSION_OVERRIDE=13.3 \ DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \ PATH=/Users/jimwinkelmann/opt/anaconda3/bin:/Users/jimwinkelmann/opt/anaconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin \ SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk \ TMPDIR=/var/folders/8g/9rknwgpd4_sb75_mpnzxxtr40000gn/T/ \ XCODE_VERSION_OVERRIDE=14.3.0.14E222b \ ZERO_AR_DATE=1 \ /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/sandbox/darwin-sandbox/1249/sandbox.sb /var/tmp/_bazel_jimwinkelmann/install/75b50ce753c66b4b3e83f1baa209bfd7/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_jimwinkelmann/23fdfb0389e746539a3bdbeb73034436/sandbox/darwin-sandbox/1249/stats.out' external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/graphs/object_detection/mobile_cpu_binary_graph_text_to_binary_graph-2.params)

I get the following: image

jimwinkpresage commented 1 year ago

So more info completely wiped my mac and did step by step installation instruction for mediapipe on mac. Same error: image

running the command that failed: image

I also had someone else try on their intel based macbook and same issue. Not sure if mediapipe has made intel based macs obsolete or whats going on. Here is my hardware info: image

jimwinkpresage commented 1 year ago

Today I was able to successfully build graphs on ubuntu 18.04 with intel cpu. Still no luck on mac though. Waiting for response...

rolandeke commented 1 year ago

I am having this error building the handtracking example. Can I get help on how to solve this

ERROR: /home/chinedumeke/.cache/bazel/_bazel_chinedumeke/9b0c45ac7d66435dc85b349a16a12d35/external/XNNPACK/BUILD.bazel:2494:19: Compiling src/microparams-init.c failed: (Exit 1): clang failed: error executing command (from target @XNNPACK//:microparams_init) 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 94 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging src/main/tools/linux-sandbox-pid1.cc:518: "execvp(external/androidndk/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang, 0x121eb70)": No such file or directory Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 2784.290s, Critical Path: 75.84s INFO: 589 processes: 332 internal, 257 linux-sandbox. FAILED: Build did NOT complete successfully

kuaashish commented 1 year ago

Hello @jimwinkpresage,

Suggest running with "--subcommands" to get a better error log, but now from log not sure the actual error causing to fail the build. Team uses Intel Macs for build verification so nothing should be broken.

jimwinkpresage commented 1 year ago

Here is the output with --subcommands and --verbose_failures image

kuaashish commented 1 year ago

Hi @schmidt-sebastian,

Could you please look into this issue. Thank you

lazeintech commented 1 year ago

I got the same issue, someone please support

schmidt-sebastian commented 1 year ago

Is this on Intel or M1 Macs? I am not able to reproduce on M1.

jimwinkpresage commented 1 year ago

Intel.

prakashsrv commented 1 year ago

Facing the same issue while I am trying to build .aar file (android archive) for facemesh.

ERROR: /Users/saurav/Documents/mediapipe/mediapipe/modules/face_detection/BUILD:99:26: Linking mediapipe/modules/face_detection/face_detection_graph_text_to_binary_graph [for tool] failed: (Exit 1): sandbox-exec failed: error executing command (cd /private/var/tmp/_bazel_root/5bc38dea76c985b4052848234924bf2f/sandbox/darwin-sandbox/542/execroot/mediapipe && \ exec env - \ APPLE_SDK_PLATFORM=MacOSX \ APPLE_SDK_VERSION_OVERRIDE=13.3 \ DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \ PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/saurav/Downloads/flutter/bin/flutter/bin:/Users/saurav/Downloads/flutter/bin:/Users/saurav/.pub-cache/bin \ SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk \ TMPDIR=/tmp \ XCODE_VERSION_OVERRIDE=14.3.0.14E222b \ ZERO_AR_DATE=1 \ /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_root/5bc38dea76c985b4052848234924bf2f/sandbox/darwin-sandbox/542/sandbox.sb /var/tmp/_bazel_root/install/f822566ff435ccaad75bcfd3b2719b0b/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_root/5bc38dea76c985b4052848234924bf2f/sandbox/darwin-sandbox/542/stats.out' external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/modules/face_detection/face_detection_graph_text_to_binary_graph-2.params) stderr (/private/var/tmp/_bazel_root/5bc38dea76c985b4052848234924bf2f/execroot/mediapipe/bazel-out/_tmp/actions/stderr-7) 1872147 exceeds maximum size of --experimental_ui_max_stdouterr_bytes=1048576 bytes; skipping Target //mediapipe/examples/android/aar_example:mediapipe_face_detection.aar failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 10.200s, Critical Path: 8.76s INFO: 144 processes: 130 internal, 14 darwin-sandbox.

bazel command :

sudo bazel build -c opt --strip=ALWAYS \ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \ --fat_apk_cpu=arm64-v8a,armeabi-v7a \ --legacy_whole_archive=0 \ --features=-legacy_whole_archive \ --copt=-fvisibility=hidden \ --copt=-ffunction-sections \ --copt=-fdata-sections \ --copt=-fstack-protector \ --copt=-Oz \ --sandbox_debug \ --copt=-fomit-frame-pointer \ --copt=-DABSL_MIN_LOG_LEVEL=2 \ --linkopt=-Wl,--gc-sections,--strip-all \ //mediapipe/examples/android/aar_example:mediapipe_face_detection.aar

artemsokol98 commented 1 year ago

Hello, I faced with the same issue, when build example FaceDetectionCPU for iOS. I have iMac 2020 Intel i5. macOS 12.6, Bazel 6.2.0. Command to produce "bazel build mediapipe/examples/ios/facedetectioncpu:FaceDetectionCpuApp --verbose_failures"

Screenshot 2023-06-01 at 17 29 55
prakashsrv commented 1 year ago

Use M1 machine. I had the same issue.

artemsokol98 commented 1 year ago

Use M1 machine. I had the same issue.

Hello, @prakashsrv. I tried, but I have got same error on M1 machine.

schmidt-sebastian commented 8 months ago

Closing due to inactivity. Please re-open if necesssary.

google-ml-butler[bot] commented 8 months ago

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