nixpkgs/pkgs/development/python-modules/tensorflow/tf-1.15-bazel-1.0.patch
Timo Kaufmann 1fbd307880 python.pkgs.tensorflow: fix build with bazel 1.0
The tensorflow build was broken by the bazel 1.0 update in
73eb01bde000c34b54764f6f2b9fd1d89a54ccfa.
2019-11-12 23:43:07 +01:00

213 lines
6.5 KiB
Diff

diff --git a/tensorflow/c/BUILD b/tensorflow/c/BUILD
index f740ba66b5..6cc9003787 100644
--- a/tensorflow/c/BUILD
+++ b/tensorflow/c/BUILD
@@ -270,6 +270,7 @@ tf_cuda_library(
"//tensorflow/core/platform",
"@com_google_absl//absl/strings",
],
+ alwayslink = 1,
)
exports_files(
diff --git a/tensorflow/c/eager/BUILD b/tensorflow/c/eager/BUILD
index 5c42e508f7..16b421862c 100644
--- a/tensorflow/c/eager/BUILD
+++ b/tensorflow/c/eager/BUILD
@@ -79,6 +79,7 @@ tf_cuda_library(
"//tensorflow/core/profiler/lib:profiler_session",
"//tensorflow/core:gpu_runtime",
],
+ alwayslink = 1,
)
tf_cuda_library(
@@ -226,6 +227,7 @@ tf_cuda_library(
"//tensorflow/core/profiler/rpc/client:capture_profile",
"//tensorflow/core:gpu_runtime",
],
+ alwayslink = 1,
)
tf_cuda_cc_test(
diff --git a/tensorflow/cc/saved_model/BUILD b/tensorflow/cc/saved_model/BUILD
index 39b84922d1..b2affdd999 100644
--- a/tensorflow/cc/saved_model/BUILD
+++ b/tensorflow/cc/saved_model/BUILD
@@ -123,6 +123,7 @@ cc_library(
"//tensorflow/core/util/tensor_bundle:naming",
# mobile not supported yet
]),
+ alwayslink = 1,
)
tf_cc_test(
diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD
index c23c1f9b39..805643b217 100644
--- a/tensorflow/core/BUILD
+++ b/tensorflow/core/BUILD
@@ -777,6 +777,7 @@ cc_library(
":lib_proto_parsing",
":protos_all_cc",
],
+ alwayslink = 1,
)
# DEPRECATED: use platform:stringpiece instead.
@@ -2496,6 +2497,7 @@ cc_library(
"@com_google_protobuf//:protobuf",
] + tf_protos_all_impl() + tf_protos_grappler_impl() +
tf_additional_numa_deps(),
+ alwayslink = 1,
)
# File compiled with extra flags to get cpu-specific acceleration.
diff --git a/tensorflow/core/lib/random/BUILD b/tensorflow/core/lib/random/BUILD
index 3bd933261b..e1e589e76d 100644
--- a/tensorflow/core/lib/random/BUILD
+++ b/tensorflow/core/lib/random/BUILD
@@ -50,6 +50,7 @@ cc_library(
"//tensorflow/core/platform:types",
"//third_party/eigen3",
],
+ alwayslink = 1,
)
filegroup(
diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl
index 5459d8d428..feba3a5686 100644
--- a/tensorflow/core/platform/default/build_config.bzl
+++ b/tensorflow/core/platform/default/build_config.bzl
@@ -228,6 +228,7 @@ def cc_proto_library(
hdrs = gen_hdrs,
deps = cc_libs + deps,
includes = includes,
+ alwayslink = 1,
**kargs
)
native.cc_library(
diff --git a/tensorflow/lite/java/src/test/native/BUILD b/tensorflow/lite/java/src/test/native/BUILD
index 6dcdab2aee..32bb0a8d85 100644
--- a/tensorflow/lite/java/src/test/native/BUILD
+++ b/tensorflow/lite/java/src/test/native/BUILD
@@ -19,6 +19,7 @@ cc_library(
"//tensorflow/lite/java/jni",
"//tensorflow/lite/kernels:kernel_util",
],
+ alwayslink = 1,
)
tflite_jni_binary(
diff --git a/tensorflow/lite/python/testdata/BUILD b/tensorflow/lite/python/testdata/BUILD
index 7bda81358f..ac1188d844 100644
--- a/tensorflow/lite/python/testdata/BUILD
+++ b/tensorflow/lite/python/testdata/BUILD
@@ -60,6 +60,7 @@ cc_library(
deps = [
"//tensorflow/lite/c:c_api_internal",
],
+ alwayslink = 1,
)
cc_binary(
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index 6fd9b4f273..29df3a3dff 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -375,6 +375,7 @@ cc_library(
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
],
+ alwayslink = 1,
)
cc_library(
@@ -411,6 +412,7 @@ cc_library(
"//third_party/py/numpy:headers",
"//third_party/python_runtime:headers",
],
+ alwayslink = 1,
)
cc_library(
@@ -617,6 +619,7 @@ cc_library(
"//tensorflow/core:op_gen_lib",
"//tensorflow/core:protos_all_cc",
],
+ alwayslink = 1,
)
py_library(
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
index a3956322fe..32752f59ad 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -2331,6 +2331,7 @@ def tf_generate_proto_text_sources(name, srcs_relative_dir, srcs, protodeps = []
hdrs = out_hdrs,
visibility = visibility,
deps = deps,
+ alwayslink = 1,
)
def tf_genrule_cmd_append_to_srcs(to_append):
diff --git a/tensorflow/tools/graph_transforms/BUILD b/tensorflow/tools/graph_transforms/BUILD
index adafe2aca1..8965316b12 100644
--- a/tensorflow/tools/graph_transforms/BUILD
+++ b/tensorflow/tools/graph_transforms/BUILD
@@ -223,6 +223,7 @@ cc_library(
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
],
+ alwayslink = 1,
)
# This library includes a main function, to make it easy to create other
diff --git a/third_party/icu/data/BUILD.bazel b/third_party/icu/data/BUILD.bazel
index 7db21566e4..8e18c7cc3a 100644
--- a/third_party/icu/data/BUILD.bazel
+++ b/third_party/icu/data/BUILD.bazel
@@ -43,4 +43,5 @@ cc_library(
name = "conversion_data",
srcs = [":conversion_data.c"],
deps = ["@icu//:headers"],
+ alwayslink = 1,
)
diff --git a/third_party/protobuf/protobuf.patch b/third_party/protobuf/protobuf.patch
index df0648563d..18fc6cdf35 100644
--- a/third_party/protobuf/protobuf.patch
+++ b/third_party/protobuf/protobuf.patch
@@ -11,7 +11,15 @@ index 2fb26050..c2744d5b 100644
################################################################################
# Protobuf Runtime Library
-@@ -218,7 +218,7 @@ cc_library(
+@@ -209,6 +209,7 @@ cc_library(
+ copts = COPTS,
+ includes = ["src/"],
+ linkopts = LINK_OPTS,
++ alwayslink = 1,
+ visibility = ["//visibility:public"],
+ deps = [":protobuf_lite"] + PROTOBUF_DEPS,
+ )
+@@ -219,7 +220,7 @@ cc_library(
# TODO(keveman): Remove this target once the support gets added to Bazel.
cc_library(
name = "protobuf_headers",
@@ -20,3 +28,4 @@ index 2fb26050..c2744d5b 100644
includes = ["src/"],
visibility = ["//visibility:public"],
)
+
\ No newline at end of file
diff --git a/third_party/systemlibs/protobuf.bzl b/third_party/systemlibs/protobuf.bzl
index 774514f3fd..1c415b018b 100644
--- a/third_party/systemlibs/protobuf.bzl
+++ b/third_party/systemlibs/protobuf.bzl
@@ -262,6 +262,7 @@ def cc_proto_library(
hdrs = gen_hdrs,
deps = cc_libs + deps,
includes = includes,
+ alwayslink = 1,
**kargs
)