ros-drivers / flir_camera_driver

168 stars 158 forks source link

Runtime issue with Spinnaker SDK 2.3.0.77 #66

Open stwirth opened 3 years ago

stwirth commented 3 years ago

I have been trying to get this driver to work in Ubuntu 20.04 (focal) / ROS noetic with the Spinnaker SDK version 2.3.0.77. After applying the patch from #63 compilation works fine but running spinnaker_test_node or camera_node results in a segmentation fault.

gdb backtrace:

Thread 2 "spinnaker_test_" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1cdf700 (LWP 8294)]
0x00007ffff535d540 in boost::detail::thread_data_base::~thread_data_base() () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
(gdb) bt
#0  0x00007ffff535d540 in boost::detail::thread_data_base::~thread_data_base() () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
#1  0x00007ffff1f1ce37 in ?? () from /opt/spinnaker/lib/flir-gentl/FLIR_GenTL.cti
#2  0x00007ffff535c19a in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
#3  0x00007ffff535d959 in boost::thread::join_noexcept() () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
#4  0x00007ffff1f14a28 in ?? () from /opt/spinnaker/lib/flir-gentl/FLIR_GenTL.cti
#5  0x00007ffff535d43b in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0
#6  0x00007ffff7daf609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#7  0x00007ffff5562293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Running the shipped example /opt/spinnaker/bin/Acquisition works fine.

To test if my build environment is the culprit, I copied the source file from /opt/spinnaker/src/Acquisition/Acquisition.cpp into flir_camera_driver/spinnaker_camera_driver/src and adapted the flir_camera_driver/spinnaker_camera_driver/CMakeLists.txt to build it. The resulting executable runs fine. Now comes the sorcery: If I just adapt that Acquisition.cpp to initialize ROS by adding #include <ros/ros.h> at the top and ros::init(argc, argv, "spinnaker_test_node"); to main(), the resulting binary crashes.

Investigating further, I found that the same with Spinnaker SDK version 2.2.0.48 works fine (which is enough for me, so I won't dig into this more).

mcamurri commented 3 years ago

I've also the same problem. The most likely cause is an incompatibility between the ros libraries and the spinnaker libraries.

When compiled in isolation, the example sources work, but when linked against ROS libraries the segfault happens.

Most likely the two libraries use different versions of boost, which caused me problems in the past with the bumblebee pointgrey driver as well.