Closed lyqaiym closed 1 year ago
Hi @lyqaiym The issue is because MP is not able to find OpenCV . Probably need to configure the paths correctly and it should work. Can you check the comments in a thread from https://github.com/google/mediapipe/issues/764#issuecomment-638984070 onwards?
Also, check the WORKSPACE file. In this file, the path to opencv should be correct. So you just check the path of the installed opencv packages (for example, libopencv-calib3d-dev) and modify the path here accordingly.
new_local_repository(
name = "macos_opencv",
build_file = "@//third_party:opencv_macos.BUILD",
# For local MacOS builds, the path should point to an opencv@3 installation.
# If you edit the path here, you will also need to update the corresponding
# prefix in "opencv_macos.BUILD".
path = "/opt/homebrew",
)
It doesn't seem to have anything to do with OpenCV.
I select Option 2.
port install opencv3
I haven't changed the file.
macos_opencv path = "/usr/local"
opencv_macos.BUILD
PREFIX = "opt/opencv@3"
cc_library( name = "opencv", srcs = glob( [ paths.join(PREFIX, "lib/libopencv_core.dylib"), paths.join(PREFIX, "lib/libopencv_calib3d.dylib"), paths.join(PREFIX, "lib/libopencv_features2d.dylib"), paths.join(PREFIX, "lib/libopencv_highgui.dylib"), paths.join(PREFIX, "lib/libopencv_imgcodecs.dylib"), paths.join(PREFIX, "lib/libopencv_imgproc.dylib"), paths.join(PREFIX, "lib/libopencv_video.dylib"), paths.join(PREFIX, "lib/libopencv_videoio.dylib"), ], ), hdrs = glob([paths.join(PREFIX, "include/opencv2/*/.h*")]), includes = [paths.join(PREFIX, "include/")], linkstatic = 1, visibility = ["//visibility:public"], )
ERROR: /Users/username/github/mediapipe/mediapipe/modules/hand_landmark/BUILD:167:26: Linking mediapipe/modules/hand_landmark/hand_landmark_landmarks_to_roi_graph_text_to_binary_graph [for tool] failed: (Exit 1): sandbox-exec failed: error executing command (cd /private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/sandbox/darwin-sandbox/9300/execroot/mediapipe && \ exec env - \ APPLE_SDK_PLATFORM=MacOSX \ APPLE_SDK_VERSION_OVERRIDE=13.3 \ DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \ PATH=/opt/local/bin:/Users/username/bin:/Users/username/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/username/Library/Android/sdk/platform-tools:/Users/username/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/::/Users/username/.gradle/wrapper/dists/gradle-6.1.1-all/cfmwm155h49vnt3hynmlrsdst/gradle-6.1.1/bin:/Users/username/Library/Android/sdk/platform-tools:/Users/username/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/::/Users/username/.gradle/wrapper/dists/gradle-6.1.1-all/cfmwm155h49vnt3hynmlrsdst/gradle-6.1.1/bin \ SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk \ TMPDIR=/var/folders/1z/8xljm54j7h3fq1x3_bwkvyt40000gp/T/ \ XCODE_VERSION_OVERRIDE=14.3.0.14E222b \ ZERO_AR_DATE=1 \ /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/sandbox/darwin-sandbox/9300/sandbox.sb /var/tmp/_bazel_username/install/f822566ff435ccaad75bcfd3b2719b0b/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/sandbox/darwin-sandbox/9300/stats.out' external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/modules/hand_landmark/hand_landmark_landmarks_to_roi_graph_text_to_binary_graph-2.params) stderr (/private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/execroot/mediapipe/bazel-out/_tmp/actions/stderr-299) 1460423 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
execroot/mediapipe/bazel-out/_tmp/actions/stderr-230
duplicate symbol 'google::protobuf::Int64Value::_classdata' in: bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) bazel-out/darwin-opt-exec-50AE0418/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) duplicate symbol 'google::protobuf::UInt32Value::_classdata' in: bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) bazel-out/darwin-opt-exec-50AE0418/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) duplicate symbol 'google::protobuf::Int32Value::_classdata' in: bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) bazel-out/darwin-opt-exec-50AE0418/bin/external/com_google_protobuf/libprotobuf.lo(wrappers.pb.o) ld: 3927 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error in child process '/usr/bin/xcrun'. 1
file hand_landmark_model_loader_graph_text_to_binary_graph-2.params multiple /libprotobuf.lo, libprotobuf_lite.lo
-Wl,-force_load,bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/mediapipe/framework/formats/libimage_format_cc_proto.lo -Wl,-force_load,bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/external/com_google_protobuf/libprotobuf.lo -Wl,-force_load,bazel-out/applebin_macos-darwin_x86_64-opt-exec-50AE0418-ST-cfb676c6944e/bin/external/com_google_protobuf/libprotobuf_lite.lo
-Wl,-force_load,bazel-out/darwin-opt-exec-50AE0418/bin/external/com_google_protobuf/libprotobuf.lo -Wl,-force_load,bazel-out/darwin-opt-exec-50AE0418/bin/external/com_google_protobuf/libprotobuf_lite.lo
delete -Wl,-force_load,bazel-out/applebin_macos-darwin_x86_64
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/sandbox/darwin-sandbox/1153/sandbox.sb /var/tmp/_bazel_username/install/75b50ce753c66b4b3e83f1baa209bfd7/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/sandbox/darwin-sandbox/1153/stats.out' /private/var/tmp/_bazel_username/cc896c897553f99ee8ee66f7814f29cf/external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-opt-exec-50AE0418/bin/mediapipe/modules/palm_detection/palm_detection_model_loader_graph_text_to_binary_graph-2.params
generate palm_detection_model_loader_graph_text_to_binary_graph executable file
Hello @lyqaiym This surely looks like a setup issue. Would you please look at this comment and check if you have made the necessary changes? Also, please use the SDK v30.0.3 and NDK v21.1.6352462.
android_sdk_repository(name = "androidsdk", build_tools_version = "30.0.3",path = "/Users/username/Android/sdk") android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/username/Android/sdk/ndk/21.1.6352462")
hi @lyqaiym, had you upgrade xcode but not restart macos system? i did that yesterday, so i met this problem. now, i have restart macos system, the issue has gone. but i' m facing new issue:
ERROR: An error occurred during the fetch of repository 'android_gmaven_r8':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/bazel_tools/tools/build_defs/repo/http.bzl", line 211, column 33, in _http_jar_impl
download_info = ctx.download(
Error in download: java.io.IOException: Error downloading [https://maven.google.com/com/android/tools/r8/3.3.28/r8-3.3.28.jar] to /private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/android_gmaven_r8/jar/downloaded.jar: connect timed out
ERROR: /DEFAULT.WORKSPACE.SUFFIX:460:6: fetching http_jar rule //external:android_gmaven_r8: Traceback (most recent call last):
File "/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/bazel_tools/tools/build_defs/repo/http.bzl", line 211, column 33, in _http_jar_impl
download_info = ctx.download(
Error in download: java.io.IOException: Error downloading [https://maven.google.com/com/android/tools/r8/3.3.28/r8-3.3.28.jar] to /private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/android_gmaven_r8/jar/downloaded.jar: connect timed out
INFO: Repository maven instantiated at:
/Users/apple/MPProject/mediapipe/WORKSPACE:417:14: in <toplevel>
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/rules_jvm_external/defs.bzl:105:19: in maven_install
Repository rule coursier_fetch defined at:
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/rules_jvm_external/coursier.bzl:1009:33: in <toplevel>
INFO: Repository android_opencv instantiated at:
/Users/apple/MPProject/mediapipe/WORKSPACE:358:13: in <toplevel>
Repository rule http_archive defined at:
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
INFO: Repository XNNPACK instantiated at:
/Users/apple/MPProject/mediapipe/WORKSPACE:494:14: in <toplevel>
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/org_tensorflow/tensorflow/workspace2.bzl:972:21: in workspace
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/org_tensorflow/tensorflow/workspace2.bzl:144:20: in _tf_repositories
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/org_tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
/private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/org_tensorflow/third_party/repo.bzl:89:35: in <toplevel>
ERROR: /private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/androidsdk/BUILD.bazel:13:25: @androidsdk//:d8_jar_import depends on @android_gmaven_r8//jar:jar in repository @android_gmaven_r8 which failed to fetch. no such package '@android_gmaven_r8//jar': java.io.IOException: Error downloading [https://maven.google.com/com/android/tools/r8/3.3.28/r8-3.3.28.jar] to /private/var/tmp/_bazel_apple/8bcb6d1f4c989e1d81eae00d06962091/external/android_gmaven_r8/jar/downloaded.jar: connect timed out
ERROR: Analysis of target '//mediapipe/examples/android/src/java/com/google/mediapipe/apps/handtrackinggpu:handtrackinggpu' failed; build aborted:
INFO: Elapsed time: 56.340s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 873 targets co\
nfigured)
Fetching https://github.com/...android-sdk.zip; 32.2 MiB (33,726,208B) 53s
Fetching https://github.com/.../coursier.jar; 14.3 MiB (15,032,320B) 26s
i had try different vpn but failed.
@lyqaiym Assuming the setup is correct, can you please run bazel clean --expunge
and then follow the build process again?
i try compile meidiapipe of 0.9.3 and had the same problem
but, i compiled mediapipe of 0.9.2.1 ,it's ok.
so, you can try the mediapipe of 0.9.2.1
yes,v0.9.2.1 and bazel 5.2.0,it's ok.
the mediapipe of v0.9.2.1 compiled ok,but the mediapipe of v0.9.3 compiled fail .
So is it the problem of v 0.9.3 ?
@ayushgdev
yes,v0.9.2.1 and bazel 5.2.0,it's ok.
the version of xcode is 14.3 or 14.2 ?
yes,v0.9.2.1 and bazel 5.2.0,it's ok.
the version of xcode is 14.3 or 14.2 ?
14.2
hello @lyqaiym Both v0.9.3 and 0.9.2.1 are compiling fine. This seems to be setup issue. Listed below are the versions which I am using. Please ensure to have the same versions and try recompilation.
diff --git a/WORKSPACE b/WORKSPACE
index 76089818..38510b3a 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -340,13 +340,13 @@ new_local_repository(
# For local MacOS builds, the path should point to an opencv@3 installation.
# If you edit the path here, you will also need to update the corresponding
# prefix in "opencv_macos.BUILD".
path = "/opt/homebrew", )
new_local_repository( name = "macos_ffmpeg", build_file = "@//third_party:ffmpeg_macos.BUILD",
path = "/opt/homebrew/opt/ffmpeg", )
new_local_repository( @@ -596,3 +596,5 @@ http_archive( urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-windows-4c63f1befa1063184c5982b11b6a2cc17d4e5815.zip"], build_file = "@//third_party:halide.BUILD", ) +android_sdk_repository(name = "androidsdk", api_level=33, build_tools_version="30.0.3") +android_ndk_repository(name = "androidndk", api_level=21)
hello @lyqaiym Both v0.9.3 and 0.9.2.1 are compiling fine. This seems to be setup issue. Listed below are the versions which I am using. Please ensure to have the same versions and try recompilation.
- MacOS- 13.3.1
- XCode - 14.1
- Bazel - controlled by .bazelversion file in corresponding MediaPipe release- 5.2.0 in v0.9.2.1 and 6.1.1 in v0.9.3.0
- openjdk version "11.0.18" 2023-01-17 LTS
- opencv is installed via Option 1 in the docs
- WORKSPACE file is edited as below (assuming opencv installation via Option 1):
diff --git a/WORKSPACE b/WORKSPACE index 76089818..38510b3a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -340,13 +340,13 @@ new_local_repository( # For local MacOS builds, the path should point to an opencv@3 installation. # If you edit the path here, you will also need to update the corresponding # prefix in "opencv_macos.BUILD". - path = "/usr/local", # e.g. /usr/local/Cellar for HomeBrew + path = "/opt/homebrew", ) new_local_repository( name = "macos_ffmpeg", build_file = "@//third_party:ffmpeg_macos.BUILD", - path = "/usr/local/opt/ffmpeg", + path = "/opt/homebrew/opt/ffmpeg", ) new_local_repository( @@ -596,3 +596,5 @@ http_archive( urls = ["https://github.com/halide/Halide/releases/download/v15.0.1/Halide-15.0.1-x86-64-windows-4c63f1befa1063184c5982b11b6a2cc17d4e5815.zip"], build_file = "@//third_party:halide.BUILD", ) +android_sdk_repository(name = "androidsdk", api_level=33, build_tools_version="30.0.3") +android_ndk_repository(name = "androidndk", api_level=21)
How about xcode14.2?
i used xcode 14.1, then, i try compile mediapipe v 0.9.3, but ,it failed
mediapipe of v0.9.2.1 is compiled ok.
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.
https://github.com/bazelbuild/bazel src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java the line 89,new version ExecutionTransitionFactory.create(),old version HostTransition.createFactory(). old is ok. ExecutionTransitionFactory.java change coreOptions.isHost = true; bazel-bin/src/bazel-dev
@lyqaiym, can you provide a bit more information on your solution. Where did you see that as a fix and do you know if there are plans to fix this issue upstream?
OS Platform and Distribution
macOs 13.3.1 (22E261)
Compiler version
No response
Programming Language and version
java version "1.8.0_271"
Installed using virtualenv? pip? Conda?(if python)
No response
MediaPipe version
master
Bazel version
6.1.1
XCode and Tulsi versions (if iOS)
14.3
Android SDK and NDK versions (if android)
ndk-r21
Android AAR (if android)
No
OpenCV version (if running on desktop)
No response
Describe the problem
Complete Logs