custom-op
custom-op copied to clipboard
How to depend on another shared library libtensorflow_cc.so?
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?
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!
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?
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.