tensorflow_ros
tensorflow_ros copied to clipboard
TensorFlow 1.3 issue
I get the following issue when running catkin_make
on the tensorflow_ros_test package:
[100%] Linking CXX executable /home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node
CMakeFiles/tensorflow_ros_test_node.dir/src/test.cpp.o: In function `main':
test.cpp:(.text+0x158): undefined reference to `tensorflow::Status::ToString[abi:cxx11]() const'
test.cpp:(.text+0x1f0): undefined reference to `tensorflow::ReadBinaryProto(tensorflow::Env*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::MessageLite*)'
test.cpp:(.text+0x265): undefined reference to `tensorflow::Status::ToString[abi:cxx11]() const'
test.cpp:(.text+0x321): undefined reference to `tensorflow::Status::ToString[abi:cxx11]() const'
test.cpp:(.text+0x6bc): undefined reference to `tensorflow::Status::ToString[abi:cxx11]() const'
test.cpp:(.text+0x742): undefined reference to `tensorflow::Tensor::DebugString[abi:cxx11]() const'
CMakeFiles/tensorflow_ros_test_node.dir/src/test.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* tensorflow::internal::MakeCheckOpString<long, int>(long const&, int const&, char const*)':
test.cpp:(.text._ZN10tensorflow8internal17MakeCheckOpStringIliEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN10tensorflow8internal17MakeCheckOpStringIliEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x7b): undefined reference to `tensorflow::internal::CheckOpMessageBuilder::NewString[abi:cxx11]()'
collect2: error: ld returned 1 exit status
tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/build.make:136: recipe for target '/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node' failed
make[2]: *** [/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node] Error 1
CMakeFiles/Makefile2:925: recipe for target 'tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all' failed
make[1]: *** [tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
Using tensorflow-gpu installed via pip. Does something need to be changed in this package to make it work or am I doing something wrong?
Can you post the output of command
gcc --version
I suppose this is because of old gcc version... You need at least 4.9 to compile TF code.
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I was able to compile tensorflow from source with this version of gcc
Aha, that's too new GCC :-D
Can you try adding
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
to CMakeLists.txt (best to both packages and you can then test if it's needed in the test package).
And if it doesn't work, you can also try with
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
Though I'm not sure if that won't break other ROS stuff...
With add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
:
[100%] Linking CXX executable /home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node
CMakeFiles/tensorflow_ros_test_node.dir/src/test.cpp.o: In function `main':
test.cpp:(.text+0xcd): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
collect2: error: ld returned 1 exit status
tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/build.make:136: recipe for target '/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node' failed
make[2]: *** [/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node] Error 1
CMakeFiles/Makefile2:925: recipe for target 'tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all' failed
make[1]: *** [tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
So I guess it's breaking other ROS stuff? haha
I get the same original error with add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
I guess I'll try with gcc-4.9. Thanks for the very prompt replies!
So running catkin_make -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 -DCMAKE_CXX_COMPILER=/usr/bin/gcc-4.9
results in
[100%] Linking CXX executable ../devel/lib/tensorflow_ros_test/tensorflow_ros_test_node
/usr/bin/ld: CMakeFiles/tensorflow_ros_test_node.dir/src/test.cpp.o: undefined reference to symbol '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/build.make:136: recipe for target 'devel/lib/tensorflow_ros_test/tensorflow_ros_test_node' failed
make[2]: *** [devel/lib/tensorflow_ros_test/tensorflow_ros_test_node] Error 1
CMakeFiles/Makefile2:925: recipe for target 'tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all' failed
make[1]: *** [tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
cmake output says that it correctly recognises gcc-4.9
Hmm... so I assume you're using Kinetic/Lunar on Ubuntu 16.04? That would mean this approach maybe only works for Indigo.
I've found a thread telling to try g++ instead of gcc, you can give it a try: https://github.com/linbox-team/fflas-ffpack/issues/8 . Or just add the -std=c++11
flag manually.
Yeah you're right, I'm using Kinetic on Ubuntu 16.04. Probably should have mentioned that earlier.
So I reset all changes I made on the repos and ran catkin_make -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9
resulting in this again:
[100%] Linking CXX executable /home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node
CMakeFiles/tensorflow_ros_test_node.dir/src/test.cpp.o: In function `main':
test.cpp:(.text+0xcd): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
collect2: error: ld returned 1 exit status
tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/build.make:136: recipe for target '/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node' failed
make[2]: *** [/home/sebastien/tf-ros_ws/devel/lib/tensorflow_ros_test/tensorflow_ros_test_node] Error 1
CMakeFiles/Makefile2:925: recipe for target 'tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all' failed
make[1]: *** [tensorflow_ros_test/CMakeFiles/tensorflow_ros_test_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
I have also tried adding add_compile_options(-std=c++11)
to both CMakeLists.txt files and trying to compile that with both versions of gcc but to no avail. Do you have any other suggestions or do you think I'm out of luck? Thanks for your help.
Can you try kinetic-devel branch of tensorflow_ros_test? I played a bit on a computer with Kinetic finally, and I think I got it working.