ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

image_transport::ImageTransport Segfault

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

TomHe gravatar image

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

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
edit retag flag offensive close merge delete

Comments

2

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 image gvdhoorn  ( 2017-11-11 05:33:55 -0500 )edit
2

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 image gvdhoorn  ( 2017-11-11 05:35:09 -0500 )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 image TomHe  ( 2017-11-12 15:43:24 -0500 )edit
1

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?

gvdhoorn gravatar image gvdhoorn  ( 2017-11-13 02:28:19 -0500 )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 image TomHe  ( 2017-11-13 11:00:22 -0500 )edit

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

TomHe gravatar image TomHe  ( 2017-11-13 11:02:54 -0500 )edit

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

SumitP gravatar image SumitP  ( 2018-02-22 04:11:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

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

Comments

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

TomHe gravatar image TomHe  ( 2017-11-13 11:43:27 -0500 )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 image gvdhoorn  ( 2017-11-13 11:44:53 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 1,551 times

Last updated: Nov 12 '17