diff --git a/README.md b/README.md index e7da3374cb..6e9ed562c2 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ To install the latest version, run the following: ``` pip install tensorflow-addons ``` - -**Note:** You will also need [TensorFlow 2.0 or higher](https://www.tensorflow.org/alpha). + +**Note:** You will also need [`tensorflow==2.0.0.a0`](https://www.tensorflow.org/alpha) installed. To use addons: @@ -76,6 +76,8 @@ import tensorflow_addons as tfa You can also install from source. This requires the [Bazel]( https://bazel.build/) build system. +**Note:** If building from master you must install `tf-nightly-2.0-preview` in the process. + ``` git clone https://github.com/tensorflow/addons.git cd addons diff --git a/configure.sh b/configure.sh index f8deeb6a00..cc0d9d0fee 100755 --- a/configure.sh +++ b/configure.sh @@ -44,6 +44,8 @@ pip install $QUIET_FLAG -r requirements.txt TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') ) TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') ) +TF_SHAREDLIB=( $(python -c 'import tensorflow as tf; print(tf.sysconfig.get_link_flags()[-1])') ) write_action_env_to_bazelrc "TF_HEADER_DIR" ${TF_CFLAGS:2} write_action_env_to_bazelrc "TF_SHARED_LIBRARY_DIR" ${TF_LFLAGS:2} +write_action_env_to_bazelrc "TF_SHARED_LIBRARY_NAME" ${TF_SHAREDLIB:3} diff --git a/tf_dependency/BUILD.tpl b/tf_dependency/BUILD.tpl index a1a225ab3a..047baee46b 100644 --- a/tf_dependency/BUILD.tpl +++ b/tf_dependency/BUILD.tpl @@ -7,14 +7,10 @@ cc_library( visibility = ["//visibility:public"], ) -# FIXME: Read shared library name from the installed python package. -# See https://github.com/tensorflow/tensorflow/issues/27430 for why we're -# linking with hardcoded framework.so.2 cc_library( name = "libtensorflow_framework", - srcs = [":libtensorflow_framework.so.2"], - #data = ["lib/libtensorflow_framework.so.2"], + srcs = ["%{TF_SHARED_LIBRARY_NAME}"], visibility = ["//visibility:public"], ) diff --git a/tf_dependency/tf_configure.bzl b/tf_dependency/tf_configure.bzl index b1f188b56c..e6cf37e262 100644 --- a/tf_dependency/tf_configure.bzl +++ b/tf_dependency/tf_configure.bzl @@ -4,6 +4,8 @@ _TF_HEADER_DIR = "TF_HEADER_DIR" _TF_SHARED_LIBRARY_DIR = "TF_SHARED_LIBRARY_DIR" +_TF_SHARED_LIBRARY_NAME = "TF_SHARED_LIBRARY_NAME" + def _tpl(repository_ctx, tpl, substitutions = {}, out = None): if not out: out = tpl @@ -183,19 +185,22 @@ def _tf_pip_impl(repository_ctx): ) tf_shared_library_dir = repository_ctx.os.environ[_TF_SHARED_LIBRARY_DIR] - tf_shared_library_path = "%s/libtensorflow_framework.so.2" % tf_shared_library_dir + tf_shared_library_name = repository_ctx.os.environ[_TF_SHARED_LIBRARY_NAME] + tf_shared_library_path = "%s/%s" % (tf_shared_library_dir, tf_shared_library_name) + tf_shared_library_rule = _symlink_genrule_for_dir( repository_ctx, None, "", - "libtensorflow_framework.so.2", + tf_shared_library_name, [tf_shared_library_path], - ["libtensorflow_framework.so.2"], + [tf_shared_library_name], ) _tpl(repository_ctx, "BUILD", { "%{TF_HEADER_GENRULE}": tf_header_rule, "%{TF_SHARED_LIBRARY_GENRULE}": tf_shared_library_rule, + "%{TF_SHARED_LIBRARY_NAME}": tf_shared_library_name, }) tf_configure = repository_rule(