Closed edwardpier closed 9 months ago
Hi, thanks for the very informative issue description.
I agree that the problem seems to be related to the coords_
member, but the changed line you mentioned is unlikely to be the cause. Rather than the different PCL versions, the important difference is probably the different installation methods (apt vs self-compiled) and different compiler options used.
Usually, we see problems with Eigen::internal::aligned_free
in one of two cases:
PCL_ENABLE_SSE
, PCL_ENABLE_AVX
, PCL_ENABLE_MARCHNATIVE
. These are ON by default, the last one is ON if the system is a UNIX, so I am unsure how the behaviour is under MSYS2. If PCL was built with SSE/AVX/MARCHNATIVE, then your own code should be, too. Ideally, you should check which flags are given to your compiler when compiling PCL vs when compiling your own codeA workaround you can also try is adding #define PCL_NO_PRECOMPILE
before including the gp3.h header. Then, when building your own code, your compiler will disregard the GreedyProjectionTriangulation instantiation from the pcl_surface.dll and recompile the class from gp3.hpp (all flags and options will be consistent).
I tried your PCL_NO_PRECOMPILE workaround and it worked! I can't thank you enough for your fast and informative response. Some time in the future I will do the more careful job of sifting through the compiler optimization flags. But I think the fact that the workaround works is a strong indication that your assessment of the problem is correct. As far as I'm concerned you can close this ticket. Thank you!
You are welcome!
Minor follow-up: the thing about C++14 vs C++17 is very likely not the problem in your case. My best guess is that the problem appeared because you did not enable AVX while compiling your code (but it was enabled while building PCL).
The example code given here: https://pcl.readthedocs.io/projects/tutorials/en/master/greedy_projection.html#greedy-triangulation crashes when the gp3 GreedyProjectionTriangulation object is destructed at the end of execution.
I have compiled PCL myself under MSYS2 on Windows 10 using GCC: cmake -G "MSYS Makefiles" This happens with the current version of PCL in the git repo as well as the version tagged pcl-1.14.0
Here is a gdb stack trace:
My best guess after reading
surface/include/pcl/surface/gp3.h surface/include/pcl/surface/impl/gp3.hpp is that there is an issue with the coords_ member variable of the GreedyProjectionTriangulation class.
I do not have this problem under Ubuntu 20.04 with PCL 1.10.0 installed out of apt. Comparing surface/include/pcl/surface/impl/gp3.hpp between 1.10.0 and 1.40.0 I see that there was a change in the way coords_ is filled:
but I don't know the code well enough to know if this is a red herring.