custom-op icon indicating copy to clipboard operation
custom-op copied to clipboard

How to depend on another shared library libtensorflow_cc.so?

Open felix5572 opened this issue 6 years ago • 3 comments

My project has to depend on both shared library libtensorflow_cc.so and libtensorflow_framework.so So I tried to edit the tf/BUILD.tpl file and added another rule as following cc_library( name = "libtensorflow_cc", srcs = [":libtensorflow_cc.so"], visibility = ["//visibility:public"], ) and edit the BUILD file like this deps = [ "@local_config_tf//:libtensorflow_framework", "@local_config_tf//:tf_header_lib", "@local_config_tf//:libtensowflow_cc", # this line is added ],

But bazel seems not to recognize this and I got an error. ERROR: /home/ubuntu/custom-op/tensorflow_zero_out/BUILD:5:1: no such target '@local_config_tf//:libtensowflow_cc': target 'libtensowflow_cc' not declared in package ''

I realize that I have to edit the tf/tf_configure.bzl file to take my modification into effect. And Could anyone please give me some advice on how to modify the tf/tf_configure.bzl file to take the rule added into effect?

felix5572 avatar Apr 16 '19 02:04 felix5572

Hi @felix5572, you will need to also create a genrule for libtensorflow_cc.so similar to https://github.com/tensorflow/custom-op/blob/master/tf/tf_configure.bzl#L186 Let us know if that helps!

yifeif avatar Apr 30 '19 22:04 yifeif

Hi. Just curious, I have not seen a libtensorflow_cc.so distributed with the pip packages so is this something that is only available if you build TF from source? There is _pywrap_tensorflow_internal.so which IIUC might include the same functionality but not sure if we're supposed to link with that?

seanpmorgan avatar Jun 26 '19 13:06 seanpmorgan

Just for someone who met the same issue, I have tried link _pywrap_tensorflow_internal.so to build a TF custom-op, it works fine.

OliverLPH avatar Jan 07 '22 08:01 OliverLPH