Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

xcode - How can add tensorflow in bazel project?

My project structure

/PROJECT
  WORKSPACE   
  BUILD 
  third_party 
      tensorflow <-- cloned repository 
  my_files 
     BUILD

In WORKSPACE file i added this

local_repository(
    name = "tensorflow",
    path = "third_party/tensorflow",
)

load("@tensorflow//tensorflow:workspace3.bzl", "workspace")
workspace()
load("@tensorflow//tensorflow:workspace2.bzl", "workspace")
workspace()
load("@tensorflow//tensorflow:workspace1.bzl", "workspace")
workspace()
load("@tensorflow//tensorflow:workspace0.bzl", "workspace")
workspace()

Initially, the following was already written in the file

#Tensorflow repo should always go after the other external dependencies.
# 2020-10-30
_TENSORFLOW_GIT_COMMIT = "84384703c0d8b502e33ff6fd7eefd219dca5ff8e"
_TENSORFLOW_SHA256= "23fb322fc15a20f7a7838d9a31f8b16f60700a494ea654311a0aa8621769df98"
http_archive(
    name = "org_tensorflow",
    urls = [
      "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
    ],
    patches = [
        "@//third_party:org_tensorflow_compatibility_fixes.diff",
    ],
    patch_args = [
        "-p1",
    ],
    strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
    sha256 = _TENSORFLOW_SHA256,
)

load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace(tf_repo_name = "org_tensorflow")

Than in my_files/BUILD i wrote following

objc_library(
  deps = [
      "@tensorflow//tensorflow/lite/objc:TensorFlowLite",
  ],
)

When building, I get the following error

    ERROR: file '_middlemen/TensorFlowLiteCMetal-ObjcCppSemantics_build_arch_ios-arm64-min10.0-
applebin_ios-ios_arm64-dbg_with_suffix__non_objc_arc' is generated by these conflicting actions:
    Label: @tensorflow//tensorflow/lite/delegates/gpu:metal_delegate, 
@org_tensorflow//tensorflow/lite/delegates/gpu:metal_delegate

ERROR: com.google.devtools.build.lib.skyframe.ArtifactConflictFinder$ConflictException: 
com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for 
_middlemen/TensorFlowLiteCMetal-ObjcCppSemantics_build_arch_ios-arm64-min10.0-applebin_ios-
ios_arm64-dbg_with_suffix__non_objc_arc, previous action: ObjcCppSemantics_build_arch_ios-
arm64-min10.0-applebin_ios-ios_arm64-dbg_with_suffix__non_objc_arc for @org_tensorflow//tensorflow/lite/delegates/gpu:metal_delegate, attempted action: 
ObjcCppSemantics_build_arch_ios-arm64-min10.0-applebin_ios-ios_arm64-
dbg_with_suffix__non_objc_arc for @tensorflow//tensorflow/lite/delegates/gpu:metal_delegate

Maybe I somehow incorrectly add tensorlow, but I do not know how to fix it

question from:https://stackoverflow.com/questions/65560180/how-can-add-tensorflow-in-bazel-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...