Closed matlabbe closed 5 years ago
If we look at the cmake of rtabmap, on this system PCL is built with -march=native
compile option:
$ cd rtabmap/build
$ cmake ..
...
-- PCL_DEFINITIONS = -DDISABLE_OPENNI2;-DDISABLE_PCAP;-DDISABLE_PNG;-DDISABLE_LIBUSB_1_0
-- PCL_COMPILE_OPTIONS = -march=native;-msse4.2;-mfpmath=sse
...
We have to rebuilt g2o from source with BUILD_WITH_MARCH_NATIVE option enabled:
$ sudo apt remove ros-melodic-libg2o
$ git clone https://github.com/RainerKuemmerle/g2o.git
$ cd g2o
$ git checkout 20170730_git
$ mkdir build
$ cd build
$ cmake -DBUILD_WITH_MARCH_NATIVE=ON ..
$ make -j4
$ sudo make install
Then rebuild rtabmap. Note that this approach can apply to other dependencies requiring EIgen like libpointmatcher (with libnabo) and gtsam. They should all be built with -march=native
if PCL has been built with this compile option.
Excuse me ,I want to see the real reason for this "double free "issue .
Does it have sth to do with "memory alignment",I wonder more,Thanks.
This post https://github.com/David-Willo/eigen_catkin/wiki/Eigen-Memory-Issues explains many pitfalls when using eigen and memory alignment issues.
currently have this issue with rtbamap 0.21 and master branch of g2o. solution did not work for me
Just tried with latest g2o and cannot reproduce this error. Try launching in gdb and show backtrace.
$ gdb rtabmap
#wait for crash, then type bt
$ bt
my cmake config
- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (USB_10)
does not match the name of the calling package (OpenNI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/Modules/FindOpenNI.cmake:28 (find_package_handle_standard_args)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:179 (find_package)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:322 (find_openni)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:548 (find_external_library)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- The imported target "vtkParseOGLExt" references the file
"/usr/bin/vtkParseOGLExt-7.1"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "pvtk" references the file
"/usr/bin/pvtk"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (libusb-1.0)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:291 (find_package_handle_standard_args)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:338 (find_libusb)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:548 (find_external_library)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so)
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (USB_10)
does not match the name of the calling package (OpenNI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/Modules/FindOpenNI.cmake:28 (find_package_handle_standard_args)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:179 (find_package)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:322 (find_openni)
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:548 (find_external_library)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_COMMON)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_OCTREE)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_IO)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_KDTREE)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_SEARCH)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_SURFACE) does not match the name of the calling package (PCL). This
can lead to problems in calling code that expects `find_package` result
variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_FILTERS) does not match the name of the calling package (PCL). This
can lead to problems in calling code that expects `find_package` result
variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_2D)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:619 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_FEATURES) does not match the name of the calling package (PCL). This
can lead to problems in calling code that expects `find_package` result
variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_REGISTRATION) does not match the name of the calling package (PCL).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_SAMPLE_CONSENSUS) does not match the name of the calling package
(PCL). This can lead to problems in calling code that expects
`find_package` result variables (e.g., `_FOUND`) to follow a certain
pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_GEOMETRY) does not match the name of the calling package (PCL). This
can lead to problems in calling code that expects `find_package` result
variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:619 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PCL_ML)
does not match the name of the calling package (PCL). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_SEGMENTATION) does not match the name of the calling package (PCL).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(PCL_VISUALIZATION) does not match the name of the calling package (PCL).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:616 (find_package_handle_standard_args)
CMakeLists.txt:234 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
-- PCL definitions don't contain "-march=native", make sure all libraries using Eigen are also compiled without that flag to avoid some segmentation faults (with gdb referring to some Eigen functions).
-- Found Sqlite3: /usr/include /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Found OpenMP: /usr/lib/gcc/x86_64-linux-gnu/9/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.so
-- Add PCL_OMP to definitions
-- Found OpenCV: /usr/include/opencv4
-- Found PCL: /usr/include/pcl-1.10;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/vtk-7.1;/usr/include/freetype2;/usr/include/x86_64-linux-gnu
-- Found ZLIB: /usr/include
-- VTK_RENDERING_BACKEND=OpenGL2
-- Found OpenNI2: /usr/include/openni2
-- Found DC1394: /usr/include/dc1394
-- Found g2o (targets)
-- g2o include dir: /usr/local/include/g2o/core;/usr/local/include
-- Latest g2o factory version detected with shared ptr (factory file: /usr/local/include/g2o/core/factory.h).
-- GTSAM include directory: /usr/local/lib/cmake/GTSAM/../../../include
-- FlyCapture2_INCLUDE_DIR=FlyCapture2_INCLUDE_DIR-NOTFOUND
-- FlyCapture2_LIBRARY=FlyCapture2_LIBRARY-NOTFOUND
-- Triclops_INCLUDE_DIR=Triclops_INCLUDE_DIR-NOTFOUND
-- Triclops_LIBRARY=Triclops_LIBRARY-NOTFOUND
-- FlyCaptureBridge_LIBRARY=FlyCaptureBridge_LIBRARY-NOTFOUND
-- Found Boost: /usr/include (found version "1.71.0") found components: thread filesystem system program_options date_time chrono atomic
-- Found Boost: /usr/include (found version "1.71.0") found components: thread filesystem system program_options date_time chrono timer serialization atomic
-- Architecture: x86_64
-- Found Pthreads
-- --------------------------------------------
-- Info :
-- RTAB-Map Version = 0.21.0
-- CMAKE_VERSION = 3.26.3
-- CMAKE_INSTALL_PREFIX = /usr/local
-- CMAKE_BUILD_TYPE = Release
-- CMAKE_INSTALL_LIBDIR = lib
-- BUILD_APP = ON
-- BUILD_TOOLS = ON
-- BUILD_EXAMPLES = ON
-- BUILD_SHARED_LIBS = ON
-- CMAKE_CXX_FLAGS = -fmessage-length=0 -fopenmp -std=c++17
-- FLANN_KDTREE_MEM_OPT = OFF
-- PCL_DEFINITIONS = -DDISABLE_OPENNI2;-DDISABLE_PCAP;-DDISABLE_PNG;-DDISABLE_LIBUSB_1_0
-- PCL_VERSION = 1.10.0
--
-- Optional dependencies ('*' affects some default parameters) :
-- *With OpenCV 4.2.0 xfeatures2d = NO, nonfree = NO (License: BSD)
-- With Qt 5.12.8 = YES (License: Open Source or Commercial)
-- With VTK 7.1 = YES (License: BSD)
-- With external SQLite3 = YES (License: Public Domain)
-- With ORB OcTree = YES (License: GPLv3)
-- With SupertPoint = NO (WITH_TORCH=OFF)
-- With Python3 = NO (WITH_PYTHON=OFF)
-- With Madgwick = YES (License: GPL)
-- With FastCV = NO (FastCV not found)
-- With PDAL = NO (PDAL not found)
--
-- Solvers:
-- With TORO = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
-- *With g2o 1.0.0 = YES (License: BSD)
-- *With GTSAM 4.0.3 = YES (License: BSD)
-- *With Ceres = NO (WITH_CERES=OFF)
-- With MRPT = NO (MRPT not found)
-- With VERTIGO = YES (License: GPLv3)
-- With cvsba = NO (WITH_CVSBA=OFF)
-- *With libpointmatcher = NO (libpointmatcher not found)
-- With CCCoreLib = NO (WITH_CCCORELIB=OFF)
-- With Open3D = NO (WITH_OPEN3D=OFF)
-- With OpenGV = NO (WITH_OPENGV=OFF)
--
-- Reconstruction Approaches:
-- With OCTOMAP = NO (octomap not found)
-- With CPUTSDF = NO (WITH_CPUTSDF=OFF)
-- With OpenChisel = NO (WITH_OPENCHISEL=OFF)
-- With AliceVision = NO (WITH_ALICE_VISION=OFF)
--
-- Camera Drivers:
-- With Freenect = NO (libfreenect not found)
-- With OpenNI2 = YES (License: Apache v2)
-- With Freenect2 = NO (libfreenect2 not found)
-- With Kinect for Windows 2 = NO (Kinect for Windows 2 SDK not found)
-- With Kinect for Azure = NO (Kinect for Azure SDK not found)
-- With dc1394 = YES (License: LGPL)
-- With FlyCapture2/Triclops = NO (Point Grey SDK not found)
-- With ZED = NO (ZED sdk and/or cuda not found)
-- With ZEDOC = NO (ZED Open Capture not found)
-- With RealSense = NO (librealsense not found)
-- With RealSense2 = NO (librealsense2 not found)
-- With MyntEyeS = NO (mynteye s sdk not found)
-- With DepthAI = NO (WITH_DEPTHAI=OFF)
--
-- Odometry Approaches:
-- With loam_velodyne = NO (WITH_LOAM=OFF)
-- With floam = NO (WITH_FLOAM=OFF)
-- With libfovis = NO (WITH_FOVIS=OFF)
-- With libviso2 = NO (WITH_VISO2=OFF)
-- With dvo_core = NO (WITH_DVO=OFF)
-- With okvis = NO (WITH_OKVIS=OFF)
-- With msckf_vio = NO (WITH_MSCKF_VIO=OFF)
-- With VINS-Fusion = NO (WITH_VINS=OFF)
-- With OpenVINS = NO (WITH_OPENVINS=OFF)
-- With ORB_SLAM = NO (WITH_ORB_SLAM=OFF)
-- Show all options with: cmake -LA | grep WITH_
-- --------------------------------------------
-- Configuring done (0.7s)
-- Generating done (0.7s)
solution was to built PCL again, and gtsam using eigen system version
cmake -DGTSAM_USE_SYSTEM_EIGEN=ON
GDB output: