image_transport::ImageTransport Segfault
Copy and pasting the codes on http://wiki.ros.org/cv_bridge/Tutoria...
and configuring xml and Cmake accordingly:
find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport ... )
When I rosrun this node, the program reports segmentation fault on it_(nh) , which is equivalent to image_transport::ImageTransport(ros::NodeHandle).
Why would it be the case?
I installed ros one weeks ago, with ros kinetic on Ubuntu 16.04, following the steps on http://wiki.ros.org/kinetic/Installat... , with desktop full install. I was using the openCV in ros package, with version 3.2.0.
This is the code to reproduce the bug:
#include "ros/ros.h"
#include <image_transport/image_transport.h>
#include "cv_bridge/cv_bridge.h"
using namespace std;
int main(int argc, char** argv) {
ros::init(argc, argv, "trigger_sync_capture");
ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
return 0;
}
The stack trace indicate something with regard to cache?
#0 0x00007ffff5fc416d in boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*) ()
from /home/tom/deepdrive/driving-dev/alpha/yucong-he/src/bfsdriver_1_1/lib/libSpinnaker.so.1
#1 0x00007fffefd41f15 in rospack::Rosstackage::getCachePath[abi:cxx11]() ()
from /opt/ros/kinetic/lib/librospack.so
#2 0x00007fffefd426e4 in rospack::Rosstackage::validateCache() ()
from /opt/ros/kinetic/lib/librospack.so
#3 0x00007fffefd441ba in rospack::Rosstackage::readCache() ()
from /opt/ros/kinetic/lib/librospack.so
#4 0x00007fffefd4687c in rospack::Rosstackage::crawl(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, bool) () from /opt/ros/kinetic/lib/librospack.so
#5 0x00007fffefd57d9b in rospack::rospack_run(int, char**, rospack::Rosstackage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) () from /opt/ros/kinetic/lib/librospack.so
#6 0x00007fffefd54077 in rospack::ROSPack::run(int, char**) ()
from /opt/ros/kinetic/lib/librospack.so
#7 0x00007fffefd5454a in rospack::ROSPack::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /opt/ros/kinetic/lib/librospack.so
#8 0x00007ffff375b1e1 in ros::package::command(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /opt/ros/kinetic/lib/libroslib.so
#9 0x00007ffff375b389 in ros::package::getPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /opt/ros/kinetic/lib/libroslib.so
#10 0x00007ffff7bb911b in pluginlib::ClassLoader<image_transport::PublisherPlugin>::ClassLoader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) ()
from /opt/ros/kinetic/lib/libimage_transport.so
#11 0x00007ffff7bb98a5 in boost::detail::sp_if_not_array<pluginlib::ClassLoader<image_transport::PublisherPlugin> >::type boost::make_shared<pluginlib::ClassLoader<image_transport::PublisherPlugin>, char [16], char [33]>(char const (&) [16], char const (&) [33]) () from /opt/ros/kinetic/lib/libimage_transport.so
#12 0x00007ffff7ba59c0 in image_transport::ImageTransport::ImageTransport(ros::NodeHandle const&) () from /opt/ros/kinetic/lib/libimage_transport.so
#13 0x0000000000402ec9 in main (argc=1, argv=0x7fffffffe008)
at /home/tom/deepdrive/driving-dev/alpha/yucong-he/src/bfsdriver_1_1/src/trigger_sync_capture.cpp:359
Please include more information. How did you install ROS, which version, what platform is this (normal x86/amd64 PC, Raspberry Pi, something else), which OS, did you use a from-source built version of OpenCV, etc?
Also: make sure you didn't perform any partial updates (ie: you only upgraded a subset of (
deb
) packages withapt-get
, or installed a binary library from somewhere without updating the rest of your system).Finally:
SEGFAULT
s will need a stacktrace to say anything about them. Look at GDB.Thank you for your help. I finally managed to access the machine and figure out the settings. Please take a look at my main thread.
Do you have multiple versions of Boost on your system?
Does
/home/tom/deepdrive/driving-dev/alpha/yucong-he/src/bfsdriver_1_1/lib/libSpinnaker.so.1
use Boost?Nope. I think I only installed ros and never downloaded boost. It contains only a 1.58.0 pre-built boost. locate libboost_system returning 1.58; printing out headers BOOST_VERSION also gives 1.58
The libSpinnaker is using boost. However it is close-sourced and I am trying to figure that version out.
@TomHe have you solved this problem? Even I am facing the same problem.