-
DescriptionI am linking GTSAM to an executable which also uses PCL and Eigen. When I launch the executable, the program immediately crashes with the following error: "Double free or corruption (out)". EnvironmentI am running this on Ubuntu 22.04 and using GCC 11.3.0. I have built GTSAM v4.1.1 and PCL 1.13.0 from source. I am also using Eigen 3.4.0. I have built GTSAM using the following options: I am building PCL with default options. Any ideas will be much appreciated! Additional informationI have tried building GTSAM in Debug mode and I am able to see that it's actually crashing during GTSAM initialization inside Eigen's DenseStorage.h, line 147, when calling EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63). Call stack:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Dang, that's a hard one. Can you try with version 4.2a9? |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I have already tried and it didn't really help. The stack trace above is actually from 4.2a9 |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I'm no great help here, maybe @ProfFan can help. |
Beta Was this translation helpful? Give feedback.
-
I also experienced this if the march-flag was set differently for different libraries. In our production setup we compile all the libraries that use eigen from source with the same compilation settings: cpp17 to avoid eigen alignment issues and the same march-flag.If you compile your project with address sanitizer, and it points to some eigen function where you typically experience this double free, I think the above suggestion might help you.
|
Beta Was this translation helpful? Give feedback.
-
I think we should convert this to discussion. @thorstink 's opinion is what I think is most likely to be the case. Remember that you have to make ABSOLUTELY SURE that your libraries are using the same settings for Eigen. |
Beta Was this translation helpful? Give feedback.
-
@enahon, any update? |
Beta Was this translation helpful? Give feedback.
I have finally found a solution, following @thorstink's suggestion. PCL 1.13 uses -march=native by default, which causes conflicts if other dependencies also rely on Eigen but are being built with different flags.
To fix the issue, all dependencies need to be built with the same march setting. In my case I disabled it completely. For PCL, this is done by building from source with the following Cmake options:
-DPCL_ENABLE_AVX=OFF
-DPCL_ENABLE_SSE=OFF
-DPCL_ENABLE_MARCHNATIVE=OFF