6

I get the following error only when I debug using gdb on my code compiled with debug flag

Program received signal SIGSEGV, Segmentation fault.
0x00007fffc79a7ff0 in boost::math::lanczos::lanczos_initializer<boost::math::lanczos::lanczos17m64, long double>::init::init() ()
from /usr/lib/libpcl_surface.so.1.7

OS: unbutu 14.04

I have the latest pcl library (1.7 Sprikelhof) and boost library (1.54)

Note, there is no segfault when running outside gdb.

djv
  • 15,168
  • 7
  • 48
  • 72
Geronimo
  • 430
  • 4
  • 10
  • I'm having the same issue with the GTSAM library. I get the segfault every time, regardless of whether I run in GDB. Please post an answer if you find one. – rcv Oct 17 '14 at 18:24
  • 1
    ran into the same issue, somehow it works if I disable C++11. – sled Nov 13 '14 at 22:38
  • Same problem here with Spherical Bessel Functions of the First and Second Kinds (sph_bessel) from boost 1.58.0: segmentation fault if C++11 enabled. – domini1000 Mar 04 '17 at 15:56

1 Answers1

8

I had a similar issue when compiling using -std=c++11 but only in Debug mode: set(CMAKE_BUILD_TYPE Debug). In Release or RelWithDebInfo mode, instead, everything was working as expected.

I solved the issue optimizing the compiled code (in Debug mode) with the -O1 option. i.e. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1").

I don't why it works but it's working for me.

Filippo Basso
  • 81
  • 1
  • 3