PCL and GTSAM link error: double free or corruption (out)
578 views
Skip to first unread message
Rakshith Vishwanatha
unread,
Oct 26, 2021, 6:59:57 PM10/26/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gtsam users
Hello,
I have a snippet of code which creates a pcl::RangeImage and processes it. Later in the program, I need to add some nodes to a gtsam graph to denote identified landmarks based on the processing performed on the range image. While I was working on this I got the run time error "double free or corruption (out) Aborted (core dumped)".
This error was thrown only when gtsam was linked to my code's executable. If gtsam was not linked to my code's executable everything runs fine.
In func() a pointcloud with random points is created and a range_image is created from this pointcloud.
range_image dimensions are printed and code exists func().
Code exits main().
Observations and Issues Noticed:
When CMakeLists.txt has "target_link_libraries(linkErr ${PCL_LIBRARIES})" the code works fine.
When that line is replaced with "target_link_libraries(linkErr ${PCL_LIBRARIES} gtsam)" the code gets the runtime error.
To help with debugging, additional observations are provided as a comment at the end of src/linkErr.cpp file.
For my use case, I can work around this issue by having two separate ros nodes (two separate executables). One that does range image processing and another which receives inputs from the first node and perform gtsam operations. However, it would be preferable to have both operations being performed in one single ros node (one single executable) to avoid any delays and packet buffers if there is speed mismatch between the range image processor ros node and the gtsam optimization ros node.
Any help here would be greatly appreciated!
Reagards,
Rakshith Vishwanatha
José Luis Blanco-Claraco
unread,
Oct 27, 2021, 12:37:50 AM10/27/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rakshith Vishwanatha, gtsam users
If you are building GTSAM from sources, this *likely* is due to GTSAM
not using the same Eigen version and/or memory alignment than PCL.
Rebuild GTSAM with CMake variables:
- GTSAM_USE_SYSTEM_EIGEN=On
- GTSAM_BUILD_WITH_MARCH_NATIVE=Off
and check if the error goes away... Those are the most common usual suspects.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rakshith Vishwanatha, gtsam users
If you're using clang or MSVC, you have a tool called Address Sanitizer. Just compile in debug with -fsanitize=address. That should give you more info where the problem is originating from.
On Wed, Oct 27, 2021 at 12:59 AM Rakshith Vishwanatha <rvis...@asu.edu> wrote:
Rakshith Vishwanatha
unread,
Oct 27, 2021, 3:13:34 PM10/27/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gtsam users
Thank you for the suggestion. I will give this a try and update the thread depending on what happens.
Rakshith Vishwanatha
unread,
Oct 27, 2021, 3:20:43 PM10/27/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gtsam users
Thank you for the input. I will take a look into Address Sanitizer if recompilation based on Jose Luis Blanco-Claraco's suggestions does not solve the issue.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gtsam users
Update on the issue: Re-building gtsam using "cmake -DGTSAM_BUILD_WITH_MARCH_NATIVE=Off .." resolved the issue.
Side note: There was a version mismatch between the system's and gtsam's Eigen libraries. This did not seem to cause the problem however, and use of the GTSAM_USE_SYSTEM_EIGEN=On flag had no effect on runtime behavior my code.
(The file "...Eigen/Eigen/src/Core/util/Macros.h" was used to check the version of Eigen)