Use Bazel-compiled TensorFlow with catkin package

asked 2019-03-11 01:29:16 -0600

naveenk.medi gravatar image

updated 2019-03-11 02:58:04 -0600

gvdhoorn gravatar image

I have built Tensorflow from source code. I am using tensorflow_ros_cpp package to integrate it with ROS. But, it is unable to locate libtensorflow_cc.so.

I have changed following lines in CMakeLists.txt

set(TF_BAZEL_LIBRARY "${CATKIN_DEVEL_PREFIX}/../libtensorflow_cc.so" CACHE STRING "Path to the bazel-compiled Tensorflow C++ library")
set(TF_BAZEL_SRC_DIR "${CATKIN_DEVEL_PREFIX}/../tensorflow-include-base" CACHE STRING "Path to the Tensorflow sources directory")

to

set(TF_BAZEL_LIBRARY "/home/vinn-naveen/me/tensor/tensorflow/bazel-bin/tensorflow/libtensorflow_cc.so" CACHE STRING "Path to the bazel-compiled Tensorflow C++ library")
set(TF_BAZEL_SRC_DIR "/home/vinn-naveen/me/tensorflow" CACHE STRING "Path to the Tensorflow sources directory")

Output of catkin_make

Base path: /home/vinn-naveen/catkin_ws
Source space: /home/vinn-naveen/catkin_ws/src
Build space: /home/vinn-naveen/catkin_ws/build
Devel space: /home/vinn-naveen/catkin_ws/devel
Install space: /home/vinn-naveen/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/vinn-naveen/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/vinn-naveen/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/vinn-naveen/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - tensorflow_ros_cpp
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'tensorflow_ros_cpp'
-- ==> add_subdirectory(tensorflow_ros_cpp)
-- 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 tensorflow_ros_cpp/cmake/detect_tf_bazel.cmake:21 (message):
  Bazel-compiled Tensorflow library
  /home/vinn-naveen/catkin_ws/devel/../libtensorflow_cc.so not found.
Call Stack (most recent call first):
  tensorflow_ros_cpp/CMakeLists.txt:90 (include)


-- - Not searching for Tensorflow from tensorflow_catkin, it is disabled.
CMake Error at tensorflow_ros_cpp/CMakeLists.txt:116 (message):
  Tensorflow was not found


-- Configuring incomplete, errors occurred!
See also "/home/vinn-naveen/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/vinn-naveen/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:318: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

How could I fix this?

edit retag flag offensive close merge delete

Comments

1

please edit your question and coyp'n'paste what you have tried in your CMakeLists.txt. Please format it using the preformatted text button (the one with 1001010 on it) and remove any clutter comments.

mgruhler gravatar imagemgruhler ( 2019-03-11 01:49:27 -0600 )edit

I've updated the title, as the old one ("catkin_make pass variables") did not seem to accurately describe what the question was about.

gvdhoorn gravatar imagegvdhoorn ( 2019-03-11 02:58:40 -0600 )edit