From 27d8720d6113b1b7a7018ba74a6b5a34df84ed7e Mon Sep 17 00:00:00 2001 From: cym Date: Thu, 5 Nov 2020 17:17:34 -0800 Subject: [PATCH] Upgrade protobuf dependency to v3.8.0 to support TensorFlow 2.2.0. PiperOrigin-RevId: 340957321 --- .bazelrc | 2 +- install.sh | 4 ++-- third_party/protobuf.BUILD | 28 ++++++---------------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/.bazelrc b/.bazelrc index 29f2c34..5573f91 100644 --- a/.bazelrc +++ b/.bazelrc @@ -60,4 +60,4 @@ test --test_output=errors # toolchain. See https://github.com/bazelbuild/bazel/issues/7899. You can # temporarily revert to the legacy flag-based way of specifying toolchains by # setting `--incompatible_use_python_toolchains=false`." -build --python_top=//:nucleus_python_runtime --incompatible_use_python_toolchains=false --incompatible_depset_is_not_iterable=false +build --python_top=//:nucleus_python_runtime --incompatible_use_python_toolchains=false diff --git a/install.sh b/install.sh index 74b3ece..7e05bd7 100755 --- a/install.sh +++ b/install.sh @@ -30,8 +30,8 @@ # Global setting for nucleus builds # ------------------------------------------------------------------------------ -NUCLEUS_BAZEL_VERSION="0.29.1" -NUCLEUS_TENSORFLOW_VERSION="2.1.0" +NUCLEUS_BAZEL_VERSION="2.0.0" +NUCLEUS_TENSORFLOW_VERSION="2.2.0" function note_build_stage { echo "========== [$(date)] Stage '${1}' starting" diff --git a/third_party/protobuf.BUILD b/third_party/protobuf.BUILD index b6787fe..eddb0d3 100644 --- a/third_party/protobuf.BUILD +++ b/third_party/protobuf.BUILD @@ -19,7 +19,7 @@ config_setting( # ZLIB configuration ################################################################################ -ZLIB_DEPS = ["@zlib_archive//:zlib"] +ZLIB_DEPS = ["@zlib//:zlib"] ################################################################################ # Protobuf Runtime Library @@ -230,10 +230,7 @@ cc_library( # TODO(keveman): Remove this target once the support gets added to Bazel. cc_library( name = "protobuf_headers", - hdrs = glob([ - "src/**/*.h", - "src/**/*.inc", - ]), + hdrs = glob(["src/**/*.h"]), includes = ["src/"], visibility = ["//visibility:public"], ) @@ -762,24 +759,11 @@ cc_binary( deps = [ ":protobuf", ":proto_api", - # This is an ugly but necessary hack to get the Nucleus protobuf - # descriptors loaded into the generated DescriptorPool managed by - # _message.so. Without this, Nucleus "fast_cpp_protos" will be - # backed by DynamicMessages and not the true C++ generated classes. - # That in turn will cause fast conversions in - # nucleus/util/proto_clif_converter.h to break. - # Also, this relies on dlopen() (which Python uses to load C++ - # extension modules like _message.so) initializing C++ static objects - # before returning. That is true on Linux, Solaris, BSD, and OS/X, - # but not guaranteed by POSIX. See - # https://stackoverflow.com/questions/40115688/are-static-c-objects-in-dynamically-loaded-libraries-initialized-before-dlopen - # "@" is the name of the base repository. We have to use that, and - # not "@nucleus" here and below, because @nucleus//foobar is somehow - # a different location than @//foobar. + # The below Nucleus-specific dependencies cause its protobuf descriptors + # to be loaded into the DescriptorPool managed by _message.so and put + # all Nucleus C++ extensions here to avoid ODR violations. See + # an internal document for more details. "@//nucleus/protos:all_nucleus_protos_cc", - # This is an even uglier hack to put all of Nucleus's C++ extension - # code into this C++ extension, so that there is only one C++ - # extension, and no ODR violations. "@//:all_extensions", ] + select({ "//conditions:default": [],