Ask Your Question

image_transport::ImageTransport Segfault

asked 2017-11-11 02:05:49 -0600

TomHe gravatar image

updated 2017-11-12 15:51:30 -0600

Copy and pasting the codes on

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 , 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/
#1  0x00007fffefd41f15 in rospack::Rosstackage::getCachePath[abi:cxx11]() ()
   from /opt/ros/kinetic/lib/
#2  0x00007fffefd426e4 in rospack::Rosstackage::validateCache() ()
   from /opt/ros/kinetic/lib/
#3  0x00007fffefd441ba in rospack::Rosstackage::readCache() ()
   from /opt/ros/kinetic/lib/
#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/
#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/
#6  0x00007fffefd54077 in rospack::ROSPack::run(int, char**) ()
   from /opt/ros/kinetic/lib/
#7  0x00007fffefd5454a in rospack::ROSPack::run(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /opt/ros/kinetic/lib/
#8  0x00007ffff375b1e1 in ros::package::command(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /opt/ros/kinetic/lib/
#9  0x00007ffff375b389 in ros::package::getPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /opt/ros/kinetic/lib/
#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/
#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/
#12 0x00007ffff7ba59c0 in image_transport::ImageTransport::ImageTransport(ros::NodeHandle const&) () from /opt/ros/kinetic/lib/
#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
edit retag flag offensive close merge delete



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?

gvdhoorn gravatar imagegvdhoorn ( 2017-11-11 05:33:55 -0600 )edit

Also: make sure you didn't perform any partial updates (ie: you only upgraded a subset of (deb) packages with apt-get, or installed a binary library from somewhere without updating the rest of your system).

Finally: SEGFAULTs will need a stacktrace to say anything about them. Look at GDB.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-11 05:35:09 -0600 )edit

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.

TomHe gravatar imageTomHe ( 2017-11-12 15:43:24 -0600 )edit

Do you have multiple versions of Boost on your system?

Does /home/tom/deepdrive/driving-dev/alpha/yucong-he/src/bfsdriver_1_1/lib/ use Boost?

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 02:28:19 -0600 )edit

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

TomHe gravatar imageTomHe ( 2017-11-13 11:00:22 -0600 )edit

The libSpinnaker is using boost. However it is close-sourced and I am trying to figure that version out.

TomHe gravatar imageTomHe ( 2017-11-13 11:02:54 -0600 )edit

@TomHe have you solved this problem? Even I am facing the same problem.

SumitP gravatar imageSumitP ( 2018-02-22 04:11:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-13 11:07:12 -0600

gvdhoorn gravatar image

The libSpinnaker is using boost.

it could very well be that it was linked against a different version of Boost and that is what is causing you problems.

edit flag offensive delete link more


Thanks and I would try to solve this problem. Removing all reference to Spinnaker solves the Segfault.

TomHe gravatar imageTomHe ( 2017-11-13 11:43:27 -0600 )edit

Then it is very likely that it is using a different version which leads to the SEGFAULTs.

See #q275710 for a similar question btw.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 11:44:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-11-11 02:05:49 -0600

Seen: 772 times

Last updated: Nov 12 '17