ethz-asl / segmap

A map representation based on 3D segments
BSD 3-Clause "New" or "Revised" License
1.07k stars 393 forks source link

Failed to build tensorflow_ros_cpp #112

Closed mengyuest closed 5 years ago

mengyuest commented 5 years ago

I am stuck in the Build tensorflow_ros_cpp section failing to compile the tensorflow_ros_cpp. I use Ubuntu16.04 and have successfully compiled tensorflow1.8 from source. The error message shows

Errors     << tensorflow_ros_cpp:cmake /home/meng/segmap_ws/logs/tensorflow_ros_cpp/build.cmake.001.log
CMake Error at /home/meng/segmap_ws/src/tensorflow_ros_cpp/CMakeLists.txt:4 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.

cd /home/meng/segmap_ws/build/tensorflow_ros_cpp; catkin build --get-env tensorflow_ros_cpp | catkin env -si  /usr/bin/cmake /home/meng/segmap_ws/src/tensorflow_ros_cpp --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/meng/segmap_ws/devel -DCMAKE_INSTALL_PREFIX=/home/meng/segmap_ws/install -DCMAKE_BUILD_TYPE=Release; cd -

Is there any extra step shall I do before compiling tensorflow_ros_cpp? Thanks for your help~

Also I am using virtual env for python3.5 and the result from pip list is

Package             Version  
------------------- ---------
absl-py             0.6.1    
astor               0.7.1    
bleach              1.5.0    
catkin-pkg          0.4.9    
docutils            0.14     
empy                3.3.2    
gast                0.2.0    
grpcio              1.16.0   
html5lib            0.9999999
Keras-Applications  1.0.5    
Keras-Preprocessing 1.0.3    
Markdown            3.0.1    
mock                2.0.0    
numpy               1.15.3   
pbr                 5.1.0    
pip                 18.1     
pkg-resources       0.0.0    
protobuf            3.6.1    
pyparsing           2.3.0    
python-dateutil     2.7.5    
PyYAML              3.13     
setuptools          40.5.0   
six                 1.11.0   
tensorboard         1.8.0    
tensorflow          1.8.0    
termcolor           1.1.0    
Werkzeug            0.14.1   
wheel               0.32.2 
smauq commented 5 years ago

Do you have ros installed? And if so it seems the ros environment might not be source, e.g. source /opt/ros/<ROS-DISTRO>/setup.bash where you need to replace <ROS-DISTRO> with the version of ros you are running.

mengyuest commented 5 years ago

Thanks for your in-time response. I sourced my ros-kinetic and catkin make again, but it showed the following error. I am not sure how to let the package find the tensorflow. In the virtual environment I can import tensorflow in python3, and I also tried to set FORCE_TF_PIP_SEARCH=True but it still failed. Do you have any suggestions on how to declare the library path or something? Thanks again.

(segmappyenv) meng@meng:~/segmap_ws$ catkin build tensorflow_ros_cpp
---------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/kinetic
Workspace:                   /home/meng/segmap_ws
---------------------------------------------------------
Source Space:       [exists] /home/meng/segmap_ws/src
Log Space:          [exists] /home/meng/segmap_ws/logs
Build Space:        [exists] /home/meng/segmap_ws/build
Devel Space:        [exists] /home/meng/segmap_ws/devel
Install Space:      [unused] /home/meng/segmap_ws/install
DESTDIR:            [unused] None
---------------------------------------------------------
Devel Space Layout:          merged
Install Space Layout:        None
---------------------------------------------------------
Additional CMake Args:       -DCMAKE_BUILD_TYPE=Release
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
---------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
---------------------------------------------------------
Workspace configuration appears valid.
---------------------------------------------------------
[build] Found '31' packages in 0.0 seconds.                                                                                      
[build] Package table is up to date.                                                                                             
Starting  >>> tensorflow_ros_cpp                                                                                                 
_________________________________________________________________________________________________________________________________
Errors     << tensorflow_ros_cpp:cmake /home/meng/segmap_ws/logs/tensorflow_ros_cpp/build.cmake.006.log                          
-- tensorflow_ros_cpp is probing the system
-- - The system uses C++11 ABI, the use of tensorflow from pip is possible, but problematic; consider compiling tensorflow yourself
-- - Not searching for Tensorflow installed by pip since the system uses C++11 ABI. Set FORCE_TF_PIP_SEARCH to force the search.
-- - Trying to find Tensorflow compiled by bazel
CMake Warning at /home/meng/segmap_ws/src/tensorflow_ros_cpp/cmake/detect_tf_bazel.cmake:21 (message):
  Bazel-compiled Tensorflow library
  /home/meng/segmap_ws/devel/../libtensorflow_cc.so not found.
Call Stack (most recent call first):
  CMakeLists.txt:89 (include)

-- - Trying to find Tensorflow from tensorflow_catkin
CMake Warning at /home/meng/segmap_ws/src/tensorflow_ros_cpp/cmake/detect_tf_catkin.cmake:4 (message):
  tensorflow_catkin was not found
Call Stack (most recent call first):
  CMakeLists.txt:104 (include)

CMake Error at /home/meng/segmap_ws/src/tensorflow_ros_cpp/CMakeLists.txt:115 (message):
  Tensorflow was not found

cd /home/meng/segmap_ws/build/tensorflow_ros_cpp; catkin build --get-env tensorflow_ros_cpp | catkin env -si  /usr/bin/cmake /home/meng/segmap_ws/src/tensorflow_ros_cpp --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/meng/segmap_ws/devel -DCMAKE_INSTALL_PREFIX=/home/meng/segmap_ws/install -DCMAKE_BUILD_TYPE=Release; cd -
.................................................................................................................................
Failed     << tensorflow_ros_cpp:cmake          [ Exited with code 1 ]                                                           
Failed    <<< tensorflow_ros_cpp                [ 0.5 seconds ]                                                                  
[build] Summary: 0 of 1 packages succeeded.                                                                                      
[build]   Ignored:   30 packages were skipped or are blacklisted.                                                                
[build]   Warnings:  None.                                                                                                       
[build]   Abandoned: None.                                                                                                       
[build]   Failed:    1 packages failed.                                                                                          
[build] Runtime: 0.6 seconds total.
smauq commented 5 years ago

As you have Ubuntu 16 you need to custom compile tensorflow for ABI compatibility. See here and here for examples on the flags for different ways of compiling tensorflow_ros_cpp by either linking against pip or bazel respectively.

mengyuest commented 5 years ago

Thanks! Following the instructions in FAQ now I can build tensorflow_ros_cpp successfully.