-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ABI problem - PCL_ENABLE_SSE changes alignment of class members #1725
Comments
I can confirm -- I experienced the same issue on ubuntu 16.04 after compiling trunk PCL. My application's cropbox was returning 0 points. Recompiling the application after adding the SSE_FLAGS from PCL to its CMAKE_CXX_FLAGS fixed the issue. |
Apparently the addition of |
I am further investigating the crash in InterativeClosestPoint which I can repreduce on three independent machines with 16.04. The first thing I that I now realize is that I have to look of 32 byte alignment since e.g.
Whether I add |
I found the root in my ICP crash: My shared library that contained the PCL ICP code was build without BTW I have to correct my comment about missing |
Hi Andreas, that sounds like an interesting problem 😃. To check if I understood the problems correctly: Initially, the layout of a CropBox object in your binary was different than the layout of the CropBox object in the PCL library due to another alignment of the transform member. After recompiling PCL without SSE support, because there were issues compiling your program with Then you started using Now, the cause for the ICP segfault is supposed to be PCL having been built with default visibility which allows Given that, the fixes would be
Actually, I had the impression by grepping through the CMake files, that PCL doesn't add definitions itself, but only adds the definitions of its dependencies. I found a comment on symbol visibility in pcl_macros.h, but it seems unused. And I'm afraid that changing this would lead to major ABI changes because of disappearing symbols. So it would technically require a major version release. I really think that someone else should have another look at this, like @taketwo or @SergioRAgostinho. Best, |
+1. I just spent a couple of hours trying to debug a seemingly inexplicable segfault in pcl::FPFHEstimation with trunk PCL built using default settings. Adding "-march=native -msse4.2 -mfpmath=sse" to the compile flags of my application seem to have fixed the problem. |
As @stefanbuettner noted before, this issue has two parts: a) SSE compiler flags; b) symbol visibility. The first part was already addressed by #1917 to a large extent. Now with #2100 we are making this even less error prone, so I consider that a) is solved. As for the b) part, we have a separate issue (#1913) to track it. I would thus propose to close this one. |
I noticed in a test program on Ubuntu 16.04, gcc version 5.4.0 20160609 with pcl 1.8 (HEAD version) that a simple CropBox filter generated completely unpredictable results. It took me some hours to track this problem down:
I had built PCL with the default option PCL_ENABLE_SSE but my application was missing the SSE build flags, e.g. specifically
-march=native -msse4.2 -mfpmath=sse
. I simply usedFIND_PACKAGE(PCL 1.8 REQUIRED)
but that currently does not set/configure any SSE related options.The reason for CropBox behaving unpredictable was uninitialized memory access. The PCL shared library and the calling application generated a slightly different class layout.
I added two debug outputs to see sizes and pointer-locations .. one in the ctor of CropBox in
pcl/filters/crop_box.h
(seen by my test app) and the other inCropBox::applyFilter
incrop_box.hpp
(which gets compiled intolibpcl_filters.so
).Here is the output that I got:
Inside CropBox ctor:
Inside applyFilter:
It seems to be very important to specify 'compatible' compiler options for a PCL client-application.
I wonder whether this problem is new in Unbuntu 16.04? Otherwise I would expect that a lot of people would have seen problems with the
CropBox
filter.As a solution maybe
PCLConfig.cmake
could set a variable which contains the SSE settings that were used during the PCL build (e.g.${SSE_FLAGS}
)?Potentially related:
The text was updated successfully, but these errors were encountered: