Now that we have removed the tensorflow.i file, bazel is doing some link

optimization which causes pywrap_tensorflow_internal.so not to be linked to
libtensorflow_framework.so. To prevent this behavior we have added a dependency
on a cc_import target in tf_cc_shared_object.

PiperOrigin-RevId: 294952433
Change-Id: Id49e7abb1171fbe5c00c0a6389ef57d9bb5713b7
This commit is contained in:
Amit Patankar 2020-02-13 10:58:06 -08:00 committed by TensorFlower Gardener
parent 618b1d75c8
commit c4c8b17313

View File

@ -2057,9 +2057,23 @@ def tf_py_wrap_cc(
],
})
# Due to b/149224972 we have to add libtensorflow_framework.so
# as a dependency so the linker doesn't try and optimize and
# remove it from pywrap_tensorflow_internal.so
# Issue: https://github.com/tensorflow/tensorflow/issues/34117
# Fix: https://github.com/tensorflow/tensorflow/commit/5caa9e83798cb510c9b49acee8a64efdb746207c
extra_deps += if_static(
extra_deps = [],
otherwise = [
clean_dep("//tensorflow:libtensorflow_framework_import_lib"),
],
)
tf_cc_shared_object(
name = cc_library_name,
srcs = [module_name + ".cc"],
# framework_so is no longer needed as libtf.so is included via the extra_deps.
framework_so = [],
copts = copts + if_not_windows([
"-Wno-self-assign",
"-Wno-sign-compare",