5

environment

Macbook air M1 2020.
Big Sur 11.3.1.

What I wanna do

I want to succeed to run "mediapipe c++ hello_world" below. https://google.github.io/mediapipe/getting_started/install.html#installing-on-macos

I tried the following tries and failed.

try1

do

Just follow the guideline
https://google.github.io/mediapipe/getting_started/install.html#installing-on-macos

  • 4.Install OpenCV and FFmpeg. => I used option1.

bug

In lesson 6, I faced a bug below.

// run lesson 6
mediapipe % bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
    mediapipe/examples/desktop/hello_world:hello_world
2021/05/23 21:06:14 Downloading https://releases.bazel.build/3.7.2/release/bazel-3.7.2-darwin-arm64...
2021/05/23 21:06:16 could not download Bazel: HTTP GET https://releases.bazel.build/3.7.2/release/bazel-3.7.2-darwin-arm64 failed with error 404
mediapipe %

try2

"try1 bug" said that bazel tried to Download bazel-3.7.2-darwin-arm64 from github release.
But, release version 3.7.2 don't have the type of darwin-arm64.
https://github.com/bazelbuild/bazel/releases/tag/3.7.2
Fortunately, release version 4.1.0 have the type of darwin-arm64.
https://github.com/bazelbuild/bazel/releases/tag/4.1.0

Then I trid to Download bazel-4.1.0-darwin-arm64.

do

In root repository "mediapipe", fix ".bazelversion" file as following.

4.1.0

Then, retried lesson 6 and the download started.

bug

But the download didn't complete successfully: I got the other bug as below.

// run lesson 6 again
mediapipe % bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
    mediapipe/examples/desktop/hello_world:hello_world

~~download process~~

ERROR: /Users/<some_mid_path>/mediapipe/mediapipe/framework/BUILD:971:11: Compiling mediapipe/framework/scheduler_queue.cc failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' ... (remaining 60 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
mediapipe/framework/scheduler_queue.cc:212:3: error: expected expression
  AUTORELEASEPOOL {
  ^
mediapipe/framework/scheduler_queue.cc:29:25: note: expanded from macro 'AUTORELEASEPOOL'
#define AUTORELEASEPOOL @autoreleasepool
                        ^
mediapipe/framework/scheduler_queue.cc:226:5: error: use of undeclared identifier 'is_idle'
    is_idle = IsIdle();
    ^
mediapipe/framework/scheduler_queue.cc:228:7: error: use of undeclared identifier 'is_idle'
  if (is_idle && idle_callback_) {
      ^
3 errors generated.
Error in child process '/usr/bin/xcrun'. 1
Target //mediapipe/examples/desktop/hello_world:hello_world failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.430s, Critical Path: 1.26s
INFO: 4 processes: 3 internal, 1 darwin-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

mediapipe % 

Now situation

Then I gave up temporarily and am questioning to you!

Could someone solve this problem??
Thanks in advance.

zousan
  • 93
  • 6

1 Answers1

1

I successfully built the HelloWorld.cc fine.

I also managed to compile Android on M1 MAC. Had some issues with NDK version and permissions but in the end it compiled and ran on my S8 Plus.

My setup

  • MacBook Pro (13-inch, M1, 2020)
  • macOS Big Sur 11.5.1
  • ndk version used : r20b (download manually and edit WORKSPACE path to ndk)

During first compile you will get a lot of permission error issues, go to and keep open during build > System Preferences > Security and Privacy > general.

When an error pops up allow to continue and restart build. Will take about 8-10 permissions before it builds.

Below is the last bit of the build process.

Warning: skipping import of repository 
'build_bazel_apple_support' because it already exists.

DEBUG: /private/var/tmp/_bazel_jeranio/794c1b4078a0aeb97ae7a379447a99a6/external/org_tensorflow/third_party/repo.bzl:108:14: 
Warning: skipping import of repository 'bazel_skylib' because it already exists.

DEBUG: /private/var/tmp/_bazel_jeranio/794c1b4078a0aeb97ae7a379447a99a6/external/org_tensorflow/third_party/repo.bzl:108:14: 
Warning: skipping import of repository 'pybind11' because it already exists.

DEBUG: /private/var/tmp/_bazel_jeranio/794c1b4078a0aeb97ae7a379447a99a6/external/tf_runtime/third_party/cuda/dependencies.bzl:51:10: The following command will download NVIDIA proprietary software. By using the software you agree to comply with the terms of the license agreement that accompanies the software. If you do not agree to the terms of the license agreement, do not use the software.

INFO: Analyzed target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu (0 packages loaded, 0 targets configured).
INFO: Found 1 target...

Target //mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu up-to-date:
  bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu/handtrackinggpu_deploy.jar
  bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu/handtrackinggpu_unsigned.apk
  bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu/handtrackinggpu.apk
INFO: Elapsed time: 2.984s, Critical Path: 0.97s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

jeranio at Jerrys-MacBook-Pro in ~/mediapipe on master [!?]
jeranio
  • 53
  • 8