Skip to content

Segfault with boost::multiprecision::float128 and boost::python::object in debian buster.

Hi, as requested I prepared a minimal failing example which shows the crashes when using eigen with boost::multiprecision::float128 and boost::python::object.

The respective library and compiler versions are following (you can see it in the cmake output when clicking on respective tests in the pipeline test):

Working:

  • boost version 1.67
  • eigen version 3.3.7
  • python version 3.7.5
  • g++ version 9.2.1

Crashing:

  • boost version 1.67
  • eigen version 3.3.7
  • python version 3.7.3
  • g++ version 8.3.0

The crashing code is compiled with this line:

g++ -O2 -g -std=gnu++14 -fPIC minimal-failing-float128.cpp -lboost_python37 -lpython3.7m -I/usr/include/python3.7m/ -I/usr/include/eigen3/ -o ../build/minimal_failing_float128 -lquadmath -D YADE_REAL_BIT=128

Also it is checked that everything works when using double (not float128) by being compiled with this line:

g++ -O2 -g -std=gnu++14 -fPIC minimal-failing-float128.cpp -lboost_python37 -lpython3.7m -I/usr/include/python3.7m/ -I/usr/include/eigen3/ -o ../build/minimal_failing_float64 -D YADE_REAL_BIT=64

The crash happens when constructing a boost::python::object with a Vector3r inside.

It is hard to say how much Eigen is to blame on this behaviour and how much boost python. The difference between compiler versions seems most significant, perhaps a newer g++ fixed some alignment issues. I don't know. Yet I still report this here, in case if others stumbled on this problem.

Edited by Janek Kozicki