tradr-project/tensorflow_ros_cpp

Unable to locate libtensorflow_cc.so

Closed this issue · 7 comments

Tensorflow (please complete the following information):

  • Version: 1.14.0
  • Installation kind: Bazel
  • Using GPU/CUDA/CUDNN : NO

Operating System (please complete the following information):

  • Distribution: Ubuntu 16.04
  • Bitness: 64bits
  • Kernel details: Linux yg00a00019051518000n00 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7 14:10:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

ROS (please complete the following information):

  • Version: kinetic
  • Installation type: system installed

Describe the bug
I am trying to make the package by linking tensor flow executable formed using bazel. I created a symbolic link of libtensorflow_cc.so in my root directory of the tensorflow_ros_cpp package. But i am still getting the error "Bazel-compiled Tensorflow library /home/yg00a00019051518000n00/anirudh_ws/src/tensorflow_ros_cpp/devel/../libtensorflow_cc.so not found".

The path of the libtensorflow_cc.so symbolic link echoed in terminal using pwd is "/home/yg00a00019051518000n00/anirudh_ws/src/tensorflow_ros_cpp/libtensorflow_cc.so".

Therefore, I don't get why cmake is not able to find the file when the path is absolutely correct.

Additional context
Add any other context about the problem here.

peci1 commented

Just a quick check - are you sure your username is yg00a00019051518000n00 ?

peci1 commented

And (if I remember correctly) the symlink should reside in workspace root, not package source root. I.e., it should be in /home/yg00a00019051518000n00/anirudh_ws in your case.

peci1 commented

If you still don't succeed, try setting CMake Variables TF_BAZEL_LIBRARY and TF_BAZEL_SRC_DIR manually before build.

Yes my username is correct. I also tried putting the symlink in root space, it did not work. I tried setting the TF_BAZEL_LIBRARY manually but the path doesn't seem to set when I use that. Correct me if I am wrong but what is the right was of passing arguments to cmake. I tried doing
cmake -D $TF_BAZEL_LIBRARY:STRING='/home/yg00a00019051518000n00/Anirudh/tensorflow/bazel-bin/tensorflow/libtensorflow_cc.so' and i get error as "CMake Error: The source directory "/home/yg00a00019051518000n00/anirudh_ws/src/tensorflow_ros_cpp/:STRING=/home/yg00a00019051518000n00/Anirudh/tensorflow/bazel-bin/tensorflow/libtensorflow_cc.so" does not exist". Why is it concatenating the current dir patch to what I am giving?

peci1 commented

catkin build --cmake-args -DTF_BAZEL_LIBRARY='/home/yg00a00019051518000n00/Anirudh/tensorflow/bazel-bin/tensorflow/libtensorflow_cc.so' if you're using catkin tools to build the ROS workspace. If you use catkin_make, just call the same with catkin_make instead of catkin build.

That worked. Thank you so much. So from what I understand, I will now be able to compile the code using catkin_make which will indirectly call bazel? That way everything ros related will be integrated with tensorflow through bazel using the tensorflow_ros_cpp package as a wrapper?

peci1 commented

Good to hear that. Just don't forget to also set the include directory correctly, otherwise ROS programs using tensorflow_ros_cpp would not compile.

No, catkin will not call bazel for you. You have to manually run the bazel build. Then you can make use of the built binaries in your ROS programs via catkin.