Build Android on MacOS failed: google_toolbox_for_mac, objc_library rule, Expected action_config for 'objc-fully-link' to be configured
See original GitHub issueSystem information
- OS Platform and Distribution (e.g., Linux Ubuntu 20.04, WSL2): macOS 11.4 Big Sur
- Target (e.g. desktop cpu, android arm64): android arm64
- Bazel version: export USE_BAZEL_VERSION=3.7.2
- Python version: 3.9.5
- GCC/G++ version: Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.5 (clang-1205.0.22.9) Target: x86_64-apple-darwin20.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
- Unity version: N/A
- Android NDK version (if building for Android): android-ndk-r18b Installed with https://raw.githubusercontent.com/google/mediapipe/master/setup_android_sdk_and_ndk.sh
#step1: ./setup_android_sdk_and_ndk.sh
#step2: vi ~/.bashrc export ANDROID_HOME=$PATH:$HOME/Android/Sdk export ANDROID_NDK_HOME=$PATH:$HOME/Android/Sdk/ndk-bundle/android-ndk-r18b
- Xcode version (if building for iOS):
Describe the problem Run into error regarding to “google_toolbox_for_mac/BUILD.bazel:21:13: in objc_library rule @google_toolbox_for_mac//:GTM_Defines: Expected action_config for ‘objc-fully-link’ to be configured” while building in MacOS.
Steps to reproduce the issue Provide the exact sequence of commands / steps that you executed before running into the problem.
sudo python build.py build --android arm64 -v
Full logs
…
INFO (build.py): Building native libraries for Android…
DEBUG (build.py): Running bazel build -c opt --config=android_arm64 //mediapipe_api/java/com/github/homuler/mediapipe:mediapipe_android
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘com_google_absl’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘com_google_protobuf’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘com_google_googletest’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘com_github_gflags_gflags’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘rules_python’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘build_bazel_rules_apple’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘build_bazel_rules_swift’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘build_bazel_apple_support’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/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_root/6ed42a7e59fbe6f00feb7169613a9105/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository ‘pybind11’ because it already exists.
DEBUG: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/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: Build options --cpu, --crosstool_top, --define, and 2 more have changed, discarding analysis cache.
ERROR: /private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/com_google_mediapipe/mediapipe/gpu/BUILD:249:13: in objc_library rule @com_google_mediapipe//mediapipe/gpu:pixel_buffer_pool_util: Expected action_config for ‘objc+±compile’ to be configured
INFO: Repository android_opencv instantiated at:
/Users/hal/Documents/GitHub/MediaPipeUnityPlugin/WORKSPACE:266:13: in <toplevel>
Repository rule http_archive defined at:
/private/var/tmp/_bazel_root/6ed42a7e59fbe6f00feb7169613a9105/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: Analysis of target ‘//mediapipe_api/java/com/github/homuler/mediapipe:mediapipe_android’ failed; build aborted: Analysis of target ‘@com_google_mediapipe//mediapipe/gpu:pixel_buffer_pool_util’ failed
INFO: Elapsed time: 5.061s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 17116 targets configured)
Traceback (most recent call last):
File “/Users/hal/Documents/GitHub/MediaPipeUnityPlugin/build.py”, line 392, in <module>
Argument().command().run()
File “/Users/hal/Documents/GitHub/MediaPipeUnityPlugin/build.py”, line 153, in run
self._run_command(self._build_android_commands())
File “/Users/hal/Documents/GitHub/MediaPipeUnityPlugin/build.py”, line 51, in _run_command
return subprocess.run(command_list, check=True)
File “/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py”, line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘[‘bazel’, ‘build’, ‘-c’, ‘opt’, ‘–config=android_arm64’, ‘//mediapipe_api/java/com/github/homuler/mediapipe:mediapipe_android’]’ returned non-zero exit status 1.
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
@zhchaoxing honestly I was almost at that same point, I’m pretty sure it all boiled down to not having the $JAVA_HOME variable set to the correct openjdk path, but all the steps I did were: i. Set JAVA_HOME path to the openjdk installed with unity (/Applications/Unity/Hub/Editor/2020.3.16f1/PlaybackEngines/AndroidPlayer/OpenJDK) ii. Downgraded Android Build Tools to 30.0.3 (anything > 30.0.3 will not build successfully 🤷🏻♂️) iii. Used ndk 19.2.5345600 instead of r21 (20 also failed to build)
I don’t know how to solve it, but I ended up scrapping the entire environment, reinstalling MacOS, following the dockerfile config and adapted it to the MacOS environemnt, and have not seen this issue again. I used Bazelisk and PyEnv to manage the bazel and python versions as the requirement is different from the official mediapipe environment, used JDK 11 and the Android NDK SDK config from the official mediapipe for both of the projects. Hope it helps.