平台:Linux Ubuntu 16.04

Tensorflow:1.4.0,从源安装

Python版本:2.7

Bazel版本:0.6.1

GPU型号和内存:笔记本电脑CPU

准确的命令重现: bazel build -c opt //tensorflow/core/user_ops:rest_api.so --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"

我在 /tensorflow/core/user_ops 中的BUILD文件:

load("//tensorflow:tensorflow.bzl", "tf_custom_op_library")

cc_library(
    name = "rest_api_dependencies",
    srcs = glob(["*.c", "*.cpp"]),
    hdrs = glob(["*.h", "*.hpp", "dict.c"]),
    linkopts = ["-pthread", "-lev", "-fexceptions"],
    deps = ["//tensorflow/core:framework", 
            "//tensorflow/core:reader_base"],
)

tf_custom_op_library(
    name = "rest_api.so",
    srcs = ["redis_reader.cc"],
    deps = ["rest_api_dependencies"],
)

我've been trying to build the shared library for my custom op reader via bazel, but the compiler is unable to find the op_def.pb.h file. It doesn'似乎在 tensorflow/core/framework 文件夹中,但它位于 bazel-genfiles/tensorflow/core/framework (从之前不相关的版本生成) . 所以我在源代码( rest_api.h )中为这个目录添加了一个include指令,但它仍然无法找到 op_def.pb.h 文件 . 我希望有人能够帮助我在这里帮助我,这里有一些从源头 Build 张量流的经验 .