Turn off Eigen Alignment in the PCL build

2019-08-09 04:55发布

So I have an issue where Eigen Alignment causes serious issues with the operating system I use, QNX. Basically the OS cannot deal with the memory that way and causes very interesting seg faults. See my other question here.

Any way, for this reason I wish to disable the Eigen Alignment used in PCL before I build it. I have a couple of ideas about how i might do this.

EIGEN INCLUDE FILES IN PCL

So PCL has the structure for most of its modules like this (this is an example of the features module):

pcl/include/pcl/features/

and in this folder there exists a eigen.h file. This seems to be where the eigen libraries are included from. I could put the macro #define EIGEN_DONT_ALIGN in each of these. Of course this is many many files in PCL, as there are a lot of modules. One potential problem with this is that the modules then have things like EIGEN_MAKE_ALIGNED_OPERATOR_NEW in a bunch of their include files. Is this going to combat my efforts to turn it off? Also there are these standrard eigen includes but other files also include Eigen directly, what should i do about those?

TURN OFF EIGEN ALIGNMENT IN EIGEN

Is there a way to do this? I have had a quick search and it doesn't seem like there is a way to install the header only library with this turned off?

OTHER IDEAS

I would be happy to hear any other suggestions with how to deal with this?

2条回答
The star\"
2楼-- · 2019-08-09 05:36

The answer by @Anycorn is outdated: starting from 3.3 (or 3.2 ?), this macro is deprecated, see this bug report, and the current state of the page describing the various macros.

You should now use EIGEN_MAX_ALIGN_BYTES=0.

查看更多
一夜七次
3楼-- · 2019-08-09 05:42

PCL uses CMake as a build system.

You can add add_definitions(-DEIGEN_DONT_ALIGN) line in CMakeLists.txt to achieve what you want

查看更多
登录 后发表回答