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

CMake build without GRPC and Python bindings fails #18931

Closed
sarlinpe opened this issue Apr 27, 2018 · 7 comments
Closed

CMake build without GRPC and Python bindings fails #18931

sarlinpe opened this issue Apr 27, 2018 · 7 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author stat:community support Status - Community Support stat:contribution welcome Status - Contributions welcome type:build/install Build and install issues

Comments

@sarlinpe
Copy link

sarlinpe commented Apr 27, 2018

System information

  • OS: Linux Ubuntu 14.04
  • Tensorflow: installed from source (master branch)
  • GCC 4.8.4
  • CMake 3.8.2
  • No GPU

Problem

The CMake build fails on Ubuntu when GRPC support is disabled.

Command

cmake \
    	-DCMAKE_INSTALL_PREFIX=../test/ \
    	-DCMAKE_BUILD_TYPE=Release \
        -Dtensorflow_BUILD_SHARED_LIB=ON \
    	-Dtensorflow_BUILD_ALL_KERNELS=ON \
    	-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF \
    	-Dtensorflow_BUILD_CC_EXAMPLE=OFF \
    	-Dtensorflow_BUILD_PYTHON_BINDINGS=OFF \
    	-Dtensorflow_ENABLE_GRPC_SUPPORT=OFF \
    	-Dtensorflow_ENABLE_SSL_SUPPORT=OFF \
    	-Dtensorflow_BUILD_CC_TESTS=OFF \
    	-Dtensorflow_BUILD_PYTHON_TESTS=OFF \
        -Dtensorflow_ENABLE_GPU=OFF ..
make

Logs

[...]
make[2]: *** No rule to make target `../grpc', needed by `tensorflow/core/debug/debug_service.grpc.pb.cc'.
Stop.
make[1]: *** [CMakeFiles/tf_protos_cc.dir/all] Error 2
@sarlinpe
Copy link
Author

Actually it also fails if the python bindings are disabled with -Dtensorflow_BUILD_PYTHON_BINDINGS=OFF:

[...]
Scanning dependencies of target tf_c_python_api
[ 65%] Building CXX object CMakeFiles/tf_c_python_api.dir/tensorflow/tensorflow/c/python_api.cc.o
/tensorflow/tensorflow/c/python_api.cc:19:64: fatal error: tensorflow/python/framework/cpp_shape_inference.pb.h: No such file or directory
 #include "tensorflow/python/framework/ccp_shape_inference.pb.h"

Why exposing these flags in the CMakeLists.txt if GRPC and Python are anyway required to successfully build ?

@sarlinpe sarlinpe changed the title CMake build without GRPC fails CMake build without GRPC and Python bindings fails Apr 27, 2018
@sarlinpe
Copy link
Author

This seems to fix the issue with the Python binding:

diff --git a/tensorflow/contrib/cmake/tf_core_framework.cmake b/tensorflow/contrib/cmake/tf_core_framework.cmake
index b47c32f..94dda24 100644
--- a/tensorflow/contrib/cmake/tf_core_framework.cmake
+++ b/tensorflow/contrib/cmake/tf_core_framework.cmake
@@ -127,6 +127,7 @@ file(GLOB_RECURSE tf_protos_cc_srcs RELATIVE ${tensorflow_source_dir}
     "${tensorflow_source_dir}/tensorflow/core/*.proto"
     "${tensorflow_source_dir}/tensorflow/contrib/boosted_trees/proto/*.proto"
     "${tensorflow_source_dir}/tensorflow/contrib/tpu/proto/*.proto"
+    "${tensorflow_source_dir}/tensorflow/python/framework/*.proto"
 )
 
 RELATIVE_PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS

Regarding the GRPC dependency, this helps:

diff --git a/tensorflow/contrib/cmake/tf_core_framework.cmake b/tensorflow/contrib/cmake/tf_core_framework.cmake
index b47c32f..34ed324 100644
--- a/tensorflow/contrib/cmake/tf_core_framework.cmake
+++ b/tensorflow/contrib/cmake/tf_core_framework.cmake
@@ -177,13 +177,16 @@ RELATIVE_PROTOBUF_TEXT_GENERATE_CPP(PROTO_TEXT_SRCS PROTO_TEXT_HDRS
 if(WIN32)
   add_library(tf_protos_cc ${PROTO_SRCS} ${PROTO_HDRS})
 else()
-  file(GLOB_RECURSE tf_protos_grpc_cc_srcs RELATIVE ${tensorflow_source_dir}
-      "${tensorflow_source_dir}/tensorflow/core/debug/*.proto"
-  )
-  RELATIVE_PROTOBUF_GENERATE_GRPC_CPP(PROTO_GRPC_SRCS PROTO_GRPC_HDRS
-      ${tensorflow_source_dir} ${tf_protos_grpc_cc_srcs}
-  )
-  add_library(tf_protos_cc ${PROTO_GRPC_SRCS} ${PROTO_GRPC_HDRS} ${PROTO_SRCS} ${PROTO_HDRS})
+  if(tensorflow_ENABLE_GRPC_SUPPORT)
+    file(GLOB_RECURSE tf_protos_grpc_cc_srcs RELATIVE ${tensorflow_source_dir}
+        "${tensorflow_source_dir}/tensorflow/core/debug/*.proto"
+    )
+    RELATIVE_PROTOBUF_GENERATE_GRPC_CPP(PROTO_GRPC_SRCS PROTO_GRPC_HDRS
+        ${tensorflow_source_dir} ${tf_protos_grpc_cc_srcs}
+    )
+    add_library(tf_protos_cc ${PROTO_GRPC_SRCS} ${PROTO_GRPC_HDRS})
+  endif(tensorflow_ENABLE_GRPC_SUPPORT)
+  add_library(tf_protos_cc ${PROTO_SRCS} ${PROTO_HDRS})
 endif()

However some issues remain with debug_io_utils.h and debug_io_utils.cc, which require GRPC and are included by debug_ops.h.

@angerson angerson added the type:build/install Build and install issues label May 1, 2018
@angerson
Copy link
Contributor

angerson commented May 1, 2018

@mrry Can you take a look at this?

@skydes Since you already have some fixes, please feel free to make a pull request!

@angerson angerson added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label May 1, 2018
@angerson angerson assigned mrry and angerson and unassigned angerson May 1, 2018
@mrry mrry added stat:contribution welcome Status - Contributions welcome stat:community support Status - Community Support and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels May 1, 2018
@mrry
Copy link
Contributor

mrry commented May 1, 2018

We don't build with these options in our continuous integration, so this particular options seems to have rotted. Opening it for community contributions.

@tilakrayal
Copy link
Contributor

@skydes
Is this still an issue?
Could you please update TensorFlow to the latest stable version v.2.6 and let us know if you are facing the same error. Thanks!

@tilakrayal tilakrayal added the stat:awaiting response Status - Awaiting response from author label Sep 9, 2021
@tilakrayal tilakrayal self-assigned this Sep 9, 2021
@sarlinpe
Copy link
Author

sarlinpe commented Sep 9, 2021

@tilakrayal I am not using TensorFlow anymore so I won't be able to help on this - closing this issue now.

@sarlinpe sarlinpe closed this as completed Sep 9, 2021
@google-ml-butler
Copy link

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

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 stat:community support Status - Community Support stat:contribution welcome Status - Contributions welcome type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants