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

Missing header error in building the example on Windows

Open simonlee327 opened this issue 5 years ago • 0 comments

Hi,

I'v got the following error when trying to build the example ‘’tensorflow_zero_out'' on Windows:

(env1) D:\MyResearch\code\customop\custom-op-master>bazel build build_pip_pkg
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
d:\myresearch\code\customop\custom-op-master/.bazelrc
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 3c77b750-5cfa-43d8-b9f9-156f1630ec5e
WARNING: C:/users/02/_bazel_02/ni2xhpqp/external/local_config_tf/BUILD:5:12: in hdrs attribute of cc_library rule @local_config_tf//:tf_header_lib: file '_api_implementation.so' from target '@local_config_tf//:tf_header_include' is not allowed in hdrs
WARNING: C:/users/02/_bazel_02/ni2xhpqp/external/local_config_tf/BUILD:5:12: in hdrs attribute of cc_library rule @local_config_tf//:tf_header_lib: file '_message.so' from target '@local_config_tf//:tf_header_include' is not allowed in hdrs
INFO: Analysed target //:build_pip_pkg (14 packages loaded, 100 targets configured).
INFO: Found 1 target...
ERROR: D:/myresearch/code/customop/custom-op-master/tensorflow_zero_out/BUILD:10:1: C++ compilation of rule '//tensorflow_zero_out:python/ops/_zero_out_ops.so' failed (Exit 2)
bazel-out/x64_windows-opt/genfiles/external/local_config_tf/include\tensorflow/core/framework/op_def.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No such file or directory
Target //:build_pip_pkg failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 10.147s, Critical Path: 3.76s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

Here are the details:

Since no docker container was provided on windows , to build the example I created a conda environment and used pip to install tensorflow cpu version 1.13.2.

Then to run the shell script "configure.sh" in conda env on Windows, I installed m2-base in conda. So Bazel is actually run in MSYS2 shell.

I'v got the following .bazelrc file after running the script "configure.sh" using bazel 0.21:

build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
build --spawn_strategy=standalone
build --strategy=Genrule=standalone
build -c opt
build --action_env TF_HEADER_DIR="D:/MyProgram/Anaconda/envs/env1/lib/site-packages/tensorflow/include"
build --action_env TF_SHARED_LIBRARY_DIR="D:/MyProgram/Anaconda/envs/env1/lib/site-packages/tensorflow/python"
build --action_env TF_SHARED_LIBRARY_NAME="_pywrap_tensorflow_internal.lib"
build --action_env TF_NEED_CUDA="0"

Then when using the command "bazel build build_pip_pkg" ,I got the missing header error mentioned above.

ERROR: D:/myresearch/code/customop/custom-op-master/tensorflow_zero_out/BUILD:10:1: C++ compilation of rule '//tensorflow_zero_out:python/ops/_zero_out_ops.so' failed (Exit 2)
bazel-out/x64_windows-opt/genfiles/external/local_config_tf/include\tensorflow/core/framework/op_def.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No such file or directory
Target //:build_pip_pkg failed to build

Actually the package :"protobuf " version 3.12.2 was installed in the conda env. I still got the same error.

Any idea to solve the problem?

Thank you.

simonlee327 avatar Jun 16 '20 05:06 simonlee327