Open BalajiPolisetty2207 opened 2 days ago
Build the Docker image. Run it on an intel computer...
docker build --tag=mediapipe .
If you want to make changes to the mediapipe sources mount the mediapipe directory
docker run -it --name mediapipe_local_mnt -v "$(pwd):/mediapipe" mediapipe:latest bash
bazel build -c opt --config=android_arm64 //mediapipe/tasks/java/com/google/mediapipe/tasks/genai:tasks_genai.aar
If you need to connect into your docker container again later...
docker start -ai mediapipe_local_mnt
You might need to install some dependencies INSIDE the docker container like zip which should be something like
apt-get install -y zip
or add it to the list in the Dockerfile
Build result goes in
bazel-bin/mediapipe/tasks/java/com/google/mediapipe/tasks/genai/tasks_genai.aar
So cp it to your mediapipe folder to get access outside the docker container
If you include the aar in your lib directory in android you may need to manually add the dependencies for the tasks_genai.aar You can see the existing dependencies for the genai lib by running something like this in your android folder (adjust name for your androidApp)
./gradlew :androidApp:dependencies --configuration debugCompileClasspath
THIS COULD BE WRONG. I'M NOT A DEV ON mediapipe team or a bazel expert.
when i am running this command bazel build -c opt --config=android_arm64 //mediapipe/tasks/java/com/google/mediapipe/tasks/genai:tasks_genai.aar in intel windows pc i am getting zlib error .
root@5486d71acc20:/mediapipe# bazel build -c opt --config=android_arm64 //mediapipe/tasks/java/com/google/mediapipe/tasks/genai:tasks_genai.aar
Starting local Bazel server and connecting to it...
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'flatbuffers' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'XNNPACK' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pthreadpool' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'cpuinfo' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_googlesource_code_re2' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'zlib' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'rules_android_ndk' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11_protobuf' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_github_glog_glog' because it already exists.
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 22. The major revisions supported by Bazel are [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]. Bazel will attempt to treat the NDK as if it was r21. This may cause compilation and linkage problems. Please download a supported NDK version.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "691a29db9c336349e48e04c5c2f4873f2890af5cbfa6e51f4de87fefe6169294"
DEBUG: Repository rules_cc instantiated at:
/mediapipe/WORKSPACE:52:13: in
@calbot @kuaashish please help how i can proceed.
I'm not really sure. I don't remember having this problem.
Another thing is inside your docker container run if you haven't...
bash setup_android_sdk_and_ndk.sh
and maybe you need to run in your docker container
apt-get install zip
Also, see these docs... https://github.com/google-ai-edge/mediapipe/blob/master/docs/getting_started/android.md https://github.com/google-ai-edge/mediapipe/blob/master/docs/getting_started/android_archive_library.md https://github.com/google-ai-edge/mediapipe/blob/master/docs/getting_started/android_solutions.md
The error is a little strange. It's sounds like it's getting the wrong version of zlib or maybe just a network or server error (java.io.IOException). Maybe try again. Try clean bazel. I forget the command for that.
Thank you @calbot i am able to proceed now and now i am getting this error
root@a343c9897bb2:/mediapipe# bazel build -c opt --config=android_arm64 //mediapipe/tasks/java/com/google/mediapipe/tasks/genai:tasks_genai.aar
Starting local Bazel server and connecting to it...
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'flatbuffers' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'XNNPACK' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pthreadpool' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'cpuinfo' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_googlesource_code_re2' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'zlib' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'rules_android_ndk' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'pybind11_protobuf' because it already exists.
DEBUG: /root/.cache/bazel/_bazel_root/4884d566396e9b67b62185751879ad14/external/org_tensorflow/third_party/repo.bzl:132:14:
Warning: skipping import of repository 'com_github_glog_glog' because it already exists.
DEBUG: Rule 'rules_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "691a29db9c336349e48e04c5c2f4873f2890af5cbfa6e51f4de87fefe6169294"
DEBUG: Repository rules_cc instantiated at:
/mediapipe/WORKSPACE:41:13: in ~~~~~^~~~~~~~
30 | __glibc_objsize0 (__dest));
| ~~~~~~
INFO: From Executing genrule @org_tensorflow//tensorflow/lite/acceleration/configuration:configuration_schema:
When you use --proto, that you should check for conformity yourself, using the existing --conform
INFO: From Generating flatbuffer files for metadata_schema_cc_srcs: //mediapipe/tasks/metadata:metadata_schema_cc_srcs:
warning: /mediapipe/mediapipe/tasks/metadata/metadata_schema.fbs:486: 21: warning: field names should be lowercase snake_case, got: sentencePiece_model
ERROR: /mediapipe/mediapipe/tasks/cc/metadata/BUILD:14:11: Compiling mediapipe/tasks/cc/metadata/metadata_extractor.cc failed: (Exit 1): clang failed: error executing command (from target //mediapipe/tasks/cc/metadata:metadata_extractor) external/androidndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -no-canonical-prefixes '--target=aarch64-linux-android21' -fdiagnostics-color -Wa,--noexecstack '-std=gnu++17' -Wc++2a-extensions ... (remaining 133 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging In file included from mediapipe/tasks/cc/metadata/metadata_extractor.cc:30: bazel-out/android-arm64-v8a-opt/bin/mediapipe/tasks/cc/metadata/metadata_parser.h:24:50: error: expected expression inline constexpr char kMetadataParserVersion[] = "1.5.0 ^ bazel-out/android-arm64-v8a-opt/bin/mediapipe/tasks/cc/metadata/metadata_parser.h:25:3: error: expected ';' after top level declarator "; ^ ; 2 errors generated. Target //mediapipe/tasks/java/com/google/mediapipe/tasks/genai:tasks_genai.aar failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 197.254s, Critical Path: 77.73s INFO: 1965 processes: 418 internal, 1547 linux-sandbox. FAILED: Build did NOT complete successfully .
Any insights how we can resolve this
I don't know. Sorry
@kuaashish please help
@calbot @kuaashish i am using ndk 21will this cause any issue while generting the code ?which version i need to use ?
I have 21 as well in my WORKSPACE file and it works for me. Are you using docker?
OS Platform and Distribution
Android
Compiler version
No response
Programming Language and version
Java
Installed using virtualenv? pip? Conda?(if python)
No response
MediaPipe version
No response
Bazel version
No response
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
need steps to build com.google.mediapipe:tasks-genai for android
Complete Logs