From 76adab72b874c49eaaca0ea18e246d9309aa2b82 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 23 Nov 2023 16:27:31 +0100 Subject: [PATCH] build TF using its internal protobuf (make sure cms uses the same protobuf version) --- tensorflow/workspace2.bzl | 13 +++++++++++++ third_party/cms/workspace.bzl | 1 - third_party/systemlibs/grpc.bazel.protobuf.bzl | 1 - third_party/systemlibs/zlib.BUILD | 3 ++- .../tsl/tsl/platform/default/build_config.bzl | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl index cda963168ac8f3..74617923b03cc1 100644 --- a/tensorflow/workspace2.bzl +++ b/tensorflow/workspace2.bzl @@ -307,6 +307,19 @@ def _tf_repositories(): urls = tf_mirror_urls("https://github.com/googleapis/googleapis/archive/6b3fdcea8bc5398be4e7e9930c693f0ea09316a0.tar.gz"), ) + tf_http_archive( + name = "com_google_protobuf", + patch_file = ["//third_party/protobuf:protobuf.patch"], + sha256 = "f66073dee0bc159157b0bd7f502d7d1ee0bc76b3c1eac9836927511bdc4b3fc1", + strip_prefix = "protobuf-3.21.9", + system_build_file = "//third_party/systemlibs:protobuf.BUILD", + system_link_files = { + "//third_party/systemlibs:protobuf.bzl": "protobuf.bzl", + "//third_party/systemlibs:protobuf_deps.bzl": "protobuf_deps.bzl", + }, + urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/v3.21.9.zip"), + ) + tf_http_archive( name = "nsync", patch_file = ["//third_party:nsync.patch"], diff --git a/third_party/cms/workspace.bzl b/third_party/cms/workspace.bzl index 48b8cb117669f6..0ee275084b90f5 100644 --- a/third_party/cms/workspace.bzl +++ b/third_party/cms/workspace.bzl @@ -193,7 +193,6 @@ def repos(): hwloc() grpc() eigen() - protobuf() pybind11() curl() zlib() diff --git a/third_party/systemlibs/grpc.bazel.protobuf.bzl b/third_party/systemlibs/grpc.bazel.protobuf.bzl index 214ff2cea1a73f..3eca97dc2311fb 100644 --- a/third_party/systemlibs/grpc.bazel.protobuf.bzl +++ b/third_party/systemlibs/grpc.bazel.protobuf.bzl @@ -4,7 +4,6 @@ _PROTO_EXTENSION = ".proto" _VIRTUAL_IMPORTS = "/_virtual_imports/" def well_known_proto_libs(): - return [] return [ "@com_google_protobuf//:any_proto", "@com_google_protobuf//:api_proto", diff --git a/third_party/systemlibs/zlib.BUILD b/third_party/systemlibs/zlib.BUILD index d65e3838c4dd9b..1b61ed363b299f 100644 --- a/third_party/systemlibs/zlib.BUILD +++ b/third_party/systemlibs/zlib.BUILD @@ -7,7 +7,8 @@ filegroup( cc_library( name = "zlib", + hdrs = ["zlib.h"], linkopts = ["-Lexternal/zlib/lib -lz"], - includes = ["include"], + includes = ["."], visibility = ["//visibility:public"], ) diff --git a/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl b/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl index 5bed6e721cc41e..3fe7b2069a1bdf 100644 --- a/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl +++ b/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl @@ -404,7 +404,7 @@ def py_proto_library( if dep != "@com_google_protobuf//:protobuf_python": genproto_deps.append(dep + "_genproto") else: - pass + genproto_deps.append("@com_google_protobuf//:well_known_types_py_pb2_genproto") proto_gen( name = name + "_genproto",