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

Can`t build with Bazel #3760

Closed
asd26187 opened this issue Oct 11, 2022 · 18 comments
Closed

Can`t build with Bazel #3760

asd26187 opened this issue Oct 11, 2022 · 18 comments
Assignees
Labels
platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe type:build/install For Build and Installation issues

Comments

@asd26187
Copy link

Please make sure that this is a build/installation issue and also refer to the troubleshooting documentation before raising any issues.

System information (Please provide as much relevant information as possible)

  • OS Platform and Distribution (e.g. Linux Ubuntu 16.04, Android 11, iOS 14.4):MacOS Monterey 12.6
  • Compiler version (e.g. gcc/g++ 8 /Apple clang version 12.0.0):Apple clang version 14.0.0
  • Programming Language and version ( e.g. C++ 14, Python 3.6, Java ):Python 3.10.7
  • Installed using virtualenv? pip? Conda? (if python):pip
  • MediaPipe version:
  • Bazel version:5.2.0
  • XCode and Tulsi versions (if iOS):Xcode 14.0.1 Tulsi Version 0.20220310.88
  • Android SDK and NDK versions (if android):
  • Android AAR ( if android):
  • OpenCV version (if running on desktop):

Describe the problem:
When I build with the Bazel build command I get the following error in the terminal, I can't understand how this error is caused or how I should eliminate it, please help me, thanks!

INFO: Repository 'rules_java' used the following cache hits instead of downloading the corresponding file.

  • Hash 'bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598' for https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip
    If the definition of 'rules_java' was updated, verify that the hashes were also updated.
    ERROR: Analysis of target '//mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp' failed; build aborted:
    INFO: Elapsed time: 31.539s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (109 packages loaded, 1601 targets configured)
    currently loading: @com_google_protobuf// ... (4 packages)
    Fetching @com_google_absl; fetching
    Fetching @macos_opencv; Restarting.
    Fetching ...s_java; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829
    22649c93d/external/rules_java/temp1980986689431104084/7cf3cefd652008d0a64a419c34c13bdca6c8
    f178.zip
    Fetching ...e_absl; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829
    22649c93d/external/com_google_absl/temp18088582760554807661/20210324.2.tar.gz
    Fetching ...or_mac; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829
    22649c93d/external/google_toolbox_for_mac/temp3594538897784615978/v2.2.1.zip

Provide the exact sequence of commands / steps that you executed before running into the problem:

Complete Logs:
Include Complete Log information or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached:

@asd26187 asd26187 added the type:build/install For Build and Installation issues label Oct 11, 2022
@kuaashish
Copy link
Collaborator

Hi @asd26187,
Could you please elaborate your query with complete details and steps to reproduce the issue from our end. Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 11, 2022
@asd26187
Copy link
Author

I followed the steps here to install python as well as bazelisk and configure mobileprovision, but when I used
bazel build -c opt --config=ios_arm64 mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp
to build handtrackinggpu, I get these errors above.
@kuaashish

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 11, 2022
@kuaashish kuaashish added platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe labels Oct 11, 2022
@kuaashish
Copy link
Collaborator

kuaashish commented Oct 11, 2022

Hi @asd26187,
Could you please share the complete error log and MediaPipe version used to investigate further. Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 11, 2022
@asd26187
Copy link
Author

asd26187 commented Oct 11, 2022

MediaPipe version:v0.8.11
This is complete error log

bazel build -c opt --config=ios_arm64 mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp
Starting local Bazel server and connecting to it...
DEBUG: Rule 'rules_foreign_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c2cdcf55ffaf49366725639e45dedd449b8c3fe22b54e31625eb80ce3a240f1e"
DEBUG: Repository rules_foreign_cc instantiated at:
  /Users/yunxiao/Desktop/testDemo/mediapipe/WORKSPACE:49:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'flatbuffers' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_googlesource_code_re2' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'zlib' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11' 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:
  /Users/yunxiao/Desktop/testDemo/mediapipe/WORKSPACE:42:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
ERROR: /Users/yunxiao/Desktop/testDemo/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:34:16: in entitlements rule //mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp_entitlements: 
Traceback (most recent call last):
	File "/private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/build_bazel_rules_apple/apple/internal/entitlement_rules.bzl", line 270, column 40, in _entitlements_impl
		bundling_support.validate_bundle_id(bundle_id)
	File "/private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/build_bazel_rules_apple/apple/internal/bundling_support.bzl", line 100, column 25, in _validate_bundle_id
		fail("Invalid character(s) in bundle_id: \"%s\"" % bundle_id)
Error in fail: Invalid character(s) in bundle_id: "*SEE_IOS_INSTRUCTIONS*.mediapipe.examples.HandTrackingGpu"
ERROR: /Users/yunxiao/Desktop/testDemo/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:34:16: Analysis of target '//mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp_entitlements' failed
INFO: Repository rules_java instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:429:6: in <toplevel>
  /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Repository google_toolbox_for_mac instantiated at:
  /Users/yunxiao/Desktop/testDemo/mediapipe/WORKSPACE:357:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c1919182922649c93d/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Repository 'google_toolbox_for_mac' used the following cache hits instead of downloading the corresponding file.
 * Hash 'e3ac053813c989a88703556df4dc4466e424e30d32108433ed6beaec76ba4fdc' for https://github.com/google/google-toolbox-for-mac/archive/v2.2.1.zip
If the definition of 'google_toolbox_for_mac' was updated, verify that the hashes were also updated.
INFO: Repository 'rules_java' used the following cache hits instead of downloading the corresponding file.
 * Hash 'bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598' for https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip
If the definition of 'rules_java' was updated, verify that the hashes were also updated.
ERROR: Analysis of target '//mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp' failed; build aborted: 
INFO: Elapsed time: 31.539s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (109 packages loaded, 1601 targets configured)
    currently loading: @com_google_protobuf// ... (4 packages)
    Fetching @com_google_absl; fetching
    Fetching @macos_opencv; Restarting.
    Fetching ...s_java; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829\
22649c93d/external/rules_java/temp1980986689431104084/7cf3cefd652008d0a64a419c34c13bdca6c8\
f178.zip
    Fetching ...e_absl; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829\
22649c93d/external/com_google_absl/temp18088582760554807661/20210324.2.tar.gz
    Fetching ...or_mac; Extracting /private/var/tmp/_bazel_yunxiao/84aa27cfb29363c19191829\
22649c93d/external/google_toolbox_for_mac/temp3594538897784615978/v2.2.1.zip

@kuaashish

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 11, 2022
@kuaashish
Copy link
Collaborator

kuaashish commented Oct 11, 2022

Hi @asd26187,
Could you verify that you have changed the bundle_id as mentioned here in the documentation. If yes, then please try the workaround mentioned in this issue #995(comment) . Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 11, 2022
@asd26187
Copy link
Author

asd26187 commented Oct 11, 2022

Hi, when I changed the Bundle id I got another error, I changed the name to MediaPipe in the BUILD file I'm not sure why this error is reported? Can you help me to see? Thank you!
@kuaashish

bazel build -c opt --config=ios_arm64 mediapipe/examples/ios/handtrackinggpu:MediaPipe
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_benchmark' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'flatbuffers' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_googlesource_code_re2' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'zlib' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_apple_support' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'xctestrunner' because it already exists.
DEBUG: /private/var/tmp/_bazel_yunxiao/6c3252f5b8b4818edac3a632a3033cff/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11' because it already exists.
ERROR: /Users/yunxiao/Desktop/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:57:5: syntax error at 'hdrs': expected ,
ERROR: Skipping 'mediapipe/examples/ios/handtrackinggpu:MediaPipe': no such target '//mediapipe/examples/ios/handtrackinggpu:MediaPipe': target 'MediaPipe' not declared in package 'mediapipe/examples/ios/handtrackinggpu' defined by /Users/yunxiao/Desktop/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '//mediapipe/examples/ios/handtrackinggpu:MediaPipe': target 'MediaPipe' not declared in package 'mediapipe/examples/ios/handtrackinggpu' defined by /Users/yunxiao/Desktop/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD
INFO: Elapsed time: 0.119s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)

This is the content of my BUILD file

load(
    "@build_bazel_rules_apple//apple:ios.bzl",
    "ios_application",
)
load(
    "//mediapipe/examples/ios:bundle_id.bzl",
    "BUNDLE_ID_PREFIX",
    "example_provisioning",
)

licenses(["notice"])

MIN_IOS_VERSION = "11.0"

alias(
    name = "handtrackinggpu",
    actual = "HandTrackingGpuApp",
)
load("@build_bazel_rules_apple//apple:ios.bzl","ios_framework",)
ios_framework(
    name = "MediaPipe"
    hdrs = [
        "HandTrackingViewController.h",
    ],
    infoplists = ["Info.plist"],
    bundle_id = BUNDLE_ID_PREFIX + ".mediapipe.examples.HandTrackingGpu",
    families = ["iphone","ipad"],
    minimum_os_version = MIN_IOS_VERSION,
    deps = [
        ":HandTrackingGpuAppLibrary",
        "@ios_opencv//:OpencvFramework",
    ],
)

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 11, 2022
@kuaashish
Copy link
Collaborator

Hi @asd26187,
Please have a look at this example to build the Hand tracking in the ios and change the bundle id as mentioned here and let us know if encountering the same error. Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 11, 2022
@asd26187
Copy link
Author

asd26187 commented Oct 11, 2022

Yes, I changed the bundleID and solved the problem just now, now there is a new problem, the framework I packaged does not work properly because the header files inside refer to the header files of other modules, how should I configure BUILD?
@kuaashish
image
image

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 11, 2022
@asd26187
Copy link
Author

Can anyone tell me how to make a mediaPipe iOS framwork?

@kuaashish
Copy link
Collaborator

Hi @asd26187,
Could you confirm that you have followed the steps to build mediapipe in the iOS as mentioned in the here. Please refer to Xcode project example shared by the Googler here .Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 13, 2022
@asd26187
Copy link
Author

asd26187 commented Oct 14, 2022

Hi @kuaashish ,
Thank you very much, I've been able to compile the ios framework with the bazel build command, but I still can't understand how to depend on the files in other directories. For example, I compiled the common static library with

bazel build -c opt --config=ios_arm64 mediapipe/examples/ios/common:common

but when I introduced the static library into my project, I got an error from xcode build : 'mediapipe/objc/MPPCameraInputSource.h' file not found, because the file MPPCameraInputSource.h is not in the common directory, how should I write the BUILD file to make sure that all the files needed for the common static library can be How should I write the BUILD file to ensure that all the files needed by the common static library are linked in? I hope I didn't cause you any trouble, best wishes.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 14, 2022
@asd26187
Copy link
Author

Hi @kuaashish
This article is already two years old,the project directory structure is not the same as before, is there a recent tutorial on packaging iOS framework?

@kuaashish
Copy link
Collaborator

Hi @asd26187,
MediaPipe (and Google) typically build a single binary from a set of target dependencies. Mediapipe targets are mainly tested for this build scheme(monolithic binary build scheme). If you succeed in linking a static mediaPipe binary, we can consider some instructions for other users. Thank you!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Oct 20, 2022
@asd26187
Copy link
Author

OK,thanks a lot!

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Oct 20, 2022
@kuaashish
Copy link
Collaborator

Hi @asd26187,
Could we move this issue to the close status as the issue has been addressed and hope doesn't require the further support from us. Thank you!

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@kuaashish kuaashish removed stat:awaiting response Waiting for user response stale labels Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe type:build/install For Build and Installation issues
Projects
None yet
Development

No branches or pull requests

3 participants