Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel-genfiles/ and *.pb.h not been generated with bazel-building tensorflow2.4.1 from source #53381

Closed
no-define opened this issue Dec 10, 2021 · 5 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author subtype:bazel Bazel related Build_Installation issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues

Comments

@no-define
Copy link

no-define commented Dec 10, 2021

System information

  • OS Platform and Distribution ( Linux Ubuntu 18.04):
  • TensorFlow installed from (source)
  • TensorFlow version: Tags v2.4.1
  • Python version: Python 3.7.6
  • Installed using virtualenv? pip? conda?: conda
  • Bazel version (if compiling from source): have tried bazel 3.4.0 、 bazel 3.1.0
  • GCC/Compiler version (if compiling from source): gcc (GCC) 7.4.0
  • CUDA/cuDNN version: cuda_11.1 , cudnn 8.0.5
  • GPU model and memory: rtx3060
  • nvidia-driver version: 460.91
  • eigen version : eigen-3.3.90

I want to build tensorflow c++ api with bazel, no errors were reported during bazel-build process .
the command I used: bazel build --config=opt --config=cuda //tensorflow:libtensorflow_cc.so

however,while compiling a C++ program, I got the following error:
fatal error: tensorflow/core/framework/device_attributes.pb.h: No such file or directory #include "tensorflow/core/framework/device_attributes.pb.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.

After that I checked the tensorflow/core/framework folder and found no *.pb.h files in it ,only some .proto files,(etc. device_attributes.proto ) . Not even the bazel-genfiles folder.
The *.pb.h files should be generated by protobuf , what's wrong with my protobuf ?
the protobuf version and url refer to workspace.bzl

I don't know how to solve it. Thanks for your help.

@no-define no-define added the type:build/install Build and install issues label Dec 10, 2021
@no-define no-define changed the title bazel-genfiles and *.pb.h not been generated with bazel-building tensorflow2.4.1 from source bazel-genfiles/ and *.pb.h not been generated with bazel-building tensorflow2.4.1 from source Dec 10, 2021
@tilakrayal tilakrayal added TF 2.4 for issues related to TF 2.4 subtype:bazel Bazel related Build_Installation issues labels Dec 10, 2021
@tilakrayal
Copy link
Contributor

@no-define ,
Could you please update TensorFlow to the latest stable version v2.7 and let us know if you are facing the same error. Also please take a look at this issue 1 and 2 with the similar error.It helps.Thanks!

@tilakrayal tilakrayal added the stat:awaiting response Status - Awaiting response from author label Dec 10, 2021
@no-define
Copy link
Author

no-define commented Dec 13, 2021

@tilakrayal hi,I've tried manually generating pb.h by command sudo protoc <protofile> --cpp_out=./
, now the original error has been fixed.

Now the error is tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply #include "unsupported/Eigen/CXX11/Tensor"

I'm going to find a fix for this problem.
Thank you anyway!

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@tangjie77wd
Copy link

unsupported/Eigen/CXX11/Tensor

You could see the solution in https://blog.csdn.net/wd1603926823/article/details/92843830 because the author solved the similar problem like the following shows:
./unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply tensorflow/core/lib/core/threadpool.cc:88:49: error: expected template-name before ‘<’ token struct ThreadPool::Impl : Eigen::ThreadPoolTempl<EigenEnvironment> { ^ tensorflow/core/lib/core/threadpool.cc:88:49: error: expected ‘{’ before ‘<’ token tensorflow/core/lib/core/threadpool.cc:88:49: error: expected unqualified-id before ‘<’ token tensorflow/core/lib/core/threadpool.cc:217:1: error: expected ‘}’ at end of input } // namespace tensorflow ^ tensorflow/core/lib/core/threadpool.cc:217:1: error: expected ‘}’ at end of input

@no-define
Copy link
Author

tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply #include "unsupported/Eigen/CXX11/Tensor"

way to solve this problem : https://stackoverflow.com/questions/54779775/issues-including-eigen-for-simple-c-tensorflow-lite-test-program

find . -name "eigen*" -type d

then edit your CMakeList.txt :
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/tf/eigen )

try replace eigen path listed one by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author subtype:bazel Bazel related Build_Installation issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

3 participants