Replace dependency on entire proto library with just the headers for contrib.

- Linking a version of the entire proto library with every .so is wasteful.
- Causes duplicate destruction of the static initialized objects causing
non-deterministic crashes.
Change: 147220106
This commit is contained in:
Manjunath Kudlur 2017-02-10 17:47:06 -08:00 committed by TensorFlower Gardener
parent 83c857f34d
commit 63ad7054ad
10 changed files with 42 additions and 13 deletions

28
BUILD
View File

@ -0,0 +1,28 @@
# Description:
# TensorFlow is an open source software library for numerical computation using
# data flow graphs.
package(
default_visibility = [
"//tensorflow:internal",
"//tensorflow_models:__subpackages__",
],
)
licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE"])
load(
"//tensorflow:tensorflow.bzl",
"cc_header_only_library",
)
cc_header_only_library(
name = "protobuf_headers",
includes = ["external/protobuf/src"],
visibility = ["//visibility:public"],
deps = [
"@protobuf//:protobuf",
],
)

View File

@ -14,7 +14,7 @@ cc_library(
":clustering_ops",
":masked_matmul_ops",
":wals_solver_ops",
"@protobuf//:protobuf",
"//:protobuf_headers",
],
)
@ -22,9 +22,9 @@ cc_library(
name = "wals_solver_ops",
srcs = ["wals_solver_ops.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)
@ -33,9 +33,9 @@ cc_library(
name = "clustering_ops",
srcs = ["clustering_ops.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)
@ -44,9 +44,9 @@ cc_library(
name = "masked_matmul_ops",
srcs = ["masked_matmul_ops.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)

View File

@ -16,8 +16,8 @@ cc_library(
"//tensorflow/contrib/ffmpeg:ffmpeg_lib.h",
],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"@protobuf//:protobuf",
],
)

View File

@ -11,9 +11,9 @@ cc_library(
name = "input_pipeline_kernels",
srcs = ["input_pipeline_kernels.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)

View File

@ -11,9 +11,9 @@ cc_library(
name = "bucketization_kernel",
srcs = ["bucketization_kernel.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)
@ -22,10 +22,10 @@ cc_library(
name = "sparse_feature_cross_kernel",
srcs = ["sparse_feature_cross_kernel.cc"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@farmhash_archive//:farmhash",
"@protobuf//:protobuf",
],
alwayslink = 1,
)

View File

@ -50,9 +50,9 @@ cc_library(
srcs = [":custom_op_sources"],
hdrs = [":custom_op_headers"],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
alwayslink = 1,
)
@ -191,9 +191,9 @@ cc_library(
"kernels/tree_utils.h",
],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
)

View File

@ -66,9 +66,9 @@ cc_library(
"core/ops/utils.h",
],
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
"@protobuf//:protobuf",
],
)

View File

@ -253,8 +253,8 @@ cc_binary(
}),
linkshared = 1,
deps = [
"//:protobuf_headers",
"//tensorflow/core:framework_headers_lib",
"@protobuf//:protobuf",
],
)

View File

@ -671,7 +671,7 @@ def cc_header_only_library(name, deps=[], **kwargs):
def tf_custom_op_library_additional_deps():
return [
"@protobuf//:protobuf",
"//:protobuf_headers",
"//third_party/eigen3",
"//tensorflow/core:framework_headers_lib",
]

View File

@ -77,6 +77,7 @@ py_binary(
filegroup(
name = "licenses",
data = [
"//:LICENSE",
"//third_party/eigen3:LICENSE",
"//third_party/hadoop:LICENSE.txt",
"@boringssl//:LICENSE",