Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android archive build #147

Closed
danielvera64 opened this issue Jul 20, 2023 · 9 comments · Fixed by #149
Closed

Android archive build #147

danielvera64 opened this issue Jul 20, 2023 · 9 comments · Fixed by #149

Comments

@danielvera64
Copy link

Hi,

I'm trying to build the Android archive using

    bazel build -c opt \
    --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
    --fat_apk_cpu=arm64-v8a \
    //mediapipe/lluvia-mediapipe/java/ai/lluvia:lluvia_aar

but I'm getting the following error

ERROR: /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/lluvia/lluvia/cpp/core/BUILD.bazel:19:11: Illegal ambiguous match on configurable attribute "linkopts" in @lluvia//lluvia/cpp/core:core_cc_library:
@lluvia//:linux
@lluvia//:android
Multiple matches are not allowed unless one is unambiguously more specialized.

Can you tell me if I'm missing something?
Thanks

@jadarve
Copy link
Owner

jadarve commented Jul 22, 2023

Hi,

I'm not able to replicate that particular error. However, I'm having other compilation errors when building the AAR (working on a fix). Could you provide the following information?

  • Host operating system.
  • Mediapipe branch/commit/version.
  • Lluvia branch/commit.
  • Android SDK and NDK versions.

@jadarve
Copy link
Owner

jadarve commented Jul 22, 2023

Could you try your build with the latest master version of this repo? I fix something regarding Android build in the rules_vulkan dependency.

@danielvera64
Copy link
Author

Hi,
I pulled your changes but I'm still having the same error. Here is my information

Host operating system: Ubuntu 20.04.6 LTS (kernel 5.15.0-76-generic)
Mediapipe branch/commit/version: master / 25b01784de1ade3f1a9219c9947693cdc59920ed / v0.10.2
Lluvia branch/commit: master / 62a7ea6
Android SDK: I have installed 30.0.3, 33.0.2, and 34.0.0
Android NDK version: 21.4.7075529

Here is the complete error log:

INFO: Build options --compilation_mode, --copt, and --fat_apk_cpu have changed, discarding analysis cache.
ERROR: /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/lluvia/lluvia/cpp/core/BUILD.bazel:19:11: Illegal ambiguous match on configurable attribute "linkopts" in @lluvia//lluvia/cpp/core:core_cc_library:
@lluvia//:linux
@lluvia//:android
Multiple matches are not allowed unless one is unambiguously more specialized.
INFO: Repository eigen_archive instantiated at:
  /home/daniel/Documents/Projects/lluvia/mediapipe/WORKSPACE:512:14: in <toplevel>
  /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/org_tensorflow/tensorflow/workspace2.bzl:988:28: in workspace
  /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/org_tensorflow/tensorflow/workspace2.bzl:67:11: in _initialize_third_party
  /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/org_tensorflow/third_party/eigen3/workspace.bzl:14:20: in repo
  /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/org_tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  /home/daniel/.cache/bazel/_bazel_daniel/2303dac16476e51ac6f2af5c006f9287/external/org_tensorflow/third_party/repo.bzl:89:35: in <toplevel>
ERROR: Analysis of target '//mediapipe/lluvia-mediapipe/java/ai/lluvia:lluvia_aar' failed; build aborted: 
INFO: Elapsed time: 0.599s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (29 packages loaded, 9077 targets configured)
    currently loading: @com_google_protobuf//java/lite
    Fetching https://storage.googleapis.com/.../eigen/-/archive/0b51f763cbbd0ed08168f88972724329f0375498/eigen-0b51f763cbbd0ed08168f88972724329f0375498.tar.gz

Let me know if you need more information.
Thanks for your help.

@jadarve
Copy link
Owner

jadarve commented Jul 25, 2023

Thanks for the extra info. I'm able to reproduce the problem on my machine (Ubuntu 22.04 LTS x86_64).

It seems that the latest versions of Mediapipe started using Bazel 6.1.1. Running the AAR build command gives the exact problem you see.

I will be working on a fix for this repo and rules_vulkan, as they share the same logic to select config settings.

If possible for your use case, you could give it a try with Mediapipe v0.9.2.1

@danielvera64
Copy link
Author

With Mediapipe v0.9.2.1 I was able to compile the Android build.

Thanks!

jadarve added a commit that referenced this issue Jul 27, 2023
)

Remove @lluvia//:linux config setting from the repository and use //conditions:default instead for build flags for Linux.

This enables building mediapipe Android Archive with newer versions of Bazel (6.1.1).
@jadarve
Copy link
Owner

jadarve commented Jul 27, 2023

Hi, I merged a solution to master. It works with the latest version of Mediapipe and Bazel 6.1.1.

Could you verify if it also works in your setup?

Thanks :)

@jadarve jadarve reopened this Jul 27, 2023
@jadarve
Copy link
Owner

jadarve commented Aug 1, 2023

Closing as inactive. Feel free to re-open the issue if the current version in master does not work.

@jadarve jadarve closed this as completed Aug 1, 2023
@danielvera64
Copy link
Author

Hi @jadarve ,

Sorry for the delay I was able to build the Android archive with your latest changes, Bazel 6.1.1 and Mediapipe 0.10.3

Thank you for your help

@jadarve
Copy link
Owner

jadarve commented Aug 2, 2023

Cool! Thanks for reporting the issue 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants