pythonPackages.tensorflow: use bazel_0

This allows us to get rid of the compatibility hacks that we had to add
(tf-1.15-bazel-1.0.patch) and also fixes #77626.
This commit is contained in:
Andreas Rammhold 2020-03-03 17:27:44 +01:00
parent 1c0de27df3
commit c7adb4ee72
No known key found for this signature in database
GPG key ID: E432E410B5E48C86
2 changed files with 7 additions and 219 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, pkgs, bazel_1, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
{ stdenv, pkgs, bazel_0, buildBazelPackage, lib, fetchFromGitHub, fetchpatch, symlinkJoin
, addOpenGLRunpath
# Python deps
, buildPythonPackage, isPy3k, pythonOlder, pythonAtLeast, python
@ -94,7 +94,7 @@ let
bazel-build = buildBazelPackage {
name = "${pname}-${version}";
bazel = bazel_1;
bazel = bazel_0;
src = fetchFromGitHub {
owner = "tensorflow";
@ -121,7 +121,6 @@ let
sha256 = "1n9ypbrx36fc1kc9cz5b3p9qhg15xxhq4nz6ap3hwqba535nakfz";
})
./tf-1.15-bazel-1.0.patch
(fetchpatch {
# be compatible with gast >0.2 instead of only gast 0.2.2
@ -283,7 +282,6 @@ let
bazelFlags = [
# temporary fixes to make the build work with bazel 0.27
"--incompatible_no_support_tools_in_action_inputs=false"
"--incompatible_use_native_patch=false"
];
bazelBuildFlags = [
"--config=opt" # optimize using the flags set in the configure phase
@ -299,9 +297,9 @@ let
# FIXME: can't (re)produce this output with current bazel.
# FIXME: build log: https://gist.github.com/andir/eff3e9c8eda5b56c8ea84903aed9cc35
sha256 = if cudaSupport then
"0gyhjvzshgj59mbns8njlfl9qpz4sdg4j0xs2dva0w2nql7cr7im"
"0bzkqjnw1crf0v91yb1frvy0l7kmjawbfwdhm89h73i8fqjab8jw"
else
"04jvg3mc2si4xdbszc1vnw1rmf22p7snbjphmnklp7bc39jxkcrz";
"1d7czp43a3a4aksvdcskbdy7dgifily1amqbz9fa6d8mkhdj5if5";
};
buildAttrs = {
@ -422,6 +420,9 @@ in buildPythonPackage {
x = np.random.uniform(size=(1,1))
y = np.random.uniform(size=(1,))
model.fit(x, y, epochs=1)
# regression test for #77626
from tensorflow.contrib import tensor_forest
EOF
'';

View file

@ -1,213 +0,0 @@
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
)