Skip to content
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

some problem about pcl and eigen #5831

Open
timetosaygoodb opened this issue Oct 3, 2023 · 15 comments
Open

some problem about pcl and eigen #5831

timetosaygoodb opened this issue Oct 3, 2023 · 15 comments
Labels
kind: bug Type of issue

Comments

@timetosaygoodb
Copy link

timetosaygoodb commented Oct 3, 2023

My code,Test3Dto3Dmatch.cpp, runs successfully when compiled in Debug mode. However, when I compile it in Release mode, I encounter a heap-buffer-overflow issue. To debug this, I added "-fno-omit-frame-pointer" and "-fsanitize=address" to the CMakeLists file. The error seems to occur within the Eigen library at Eigen::internal::handmade_aligned_free(void)*. I suspect the issue may be within functions like bimToslam::ISSextractor::operator() and bimToslam::Frontend::ExtractandMatchISS(), which are used for point cloud feature extraction. To investigate further, I created a new test file, TestISSextractor.cpp, and removed the parts related to Eigen. However, I still encounter the same error, roughly as follows:

==21835==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fffd3e607f8 at pc 0x5555555e6f82 bp 0x7fffda9fd3e0 sp 0x7fffda9fd3d0 READ of size 8 at 0x7fffd3e607f8 thread T1 ... 0x7fffd3e607f8 is located 8 bytes to the left of 15672944-byte region [0x7fffd3e60800,0x7fffd4d52e70) allocated by thread T1 here: #0 0x7ffff6ef6b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) #1 0x7ffff602fa88 in Eigen::internal::aligned_malloc(unsigned long) (/usr/lib/x86_64-linux-gnu/libpcl_filters.so.1.8+0x311a88)

I tried searching online and found similar issues, suggesting a problem between PCL and Eigen libraries. Some solutions involve enabling AVX instruction sets, so I added "-mavx2" in the CMakeLists file, but the issue remains unresolved. Here is my codehttps://github.com/timetosaygoodb/bimToslam.Here is the reference #4859

@timetosaygoodb timetosaygoodb added the status: triage Labels incomplete label Oct 3, 2023
@mvieth
Copy link
Member

mvieth commented Oct 3, 2023

Try also -march=native or -msse4.2.
However, your PCL version is quite old, and I would recommend you to switch to a newer one. I believe there was a fix since then that solved this problem (on Linux, when using CMake).

@timetosaygoodb
Copy link
Author

Try also -march=native or -msse4.2. However, your PCL version is quite old, and I would recommend you to switch to a newer one. I believe there was a fix since then that solved this problem (on Linux, when using CMake).

Thank you for your suggestion, but the problem is still not solved. I also used pcl1.13 and the problem still occurred.

@mvieth
Copy link
Member

mvieth commented Oct 4, 2023

I saw that you use a few other libraries in your project. I am not sure whether there might be some unfortunate interaction between PCL, Eigen, and one of those libraries.
Another thing you can try is add -DEIGEN_HAS_CXX17_OVERALIGN=0 to your compiler options.

@mvieth mvieth added kind: bug Type of issue and removed status: triage Labels incomplete labels Oct 4, 2023
@timetosaygoodb
Copy link
Author

I saw that you use a few other libraries in your project. I am not sure whether there might be some unfortunate interaction between PCL, Eigen, and one of those libraries. Another thing you can try is add -DEIGEN_HAS_CXX17_OVERALIGN=0 to your compiler options.
Thank you for your suggestion again, but it is still occurred. It makes me very distressed, in Chinese, 头皮发麻

@mvieth
Copy link
Member

mvieth commented Oct 9, 2023

Can you create a minimal reproducible example, meaning a program that makes the problem occur but is a short as possible, and has no dependencies on OpenCV, Pangolin, and the other libraries? (depending on PCL is okay of course)
I don't really have the time currently to build the repository you linked and install all the required libraries.

@themightyoarfish
Copy link
Contributor

be sure to add ${PCL_DEFINITIONS} to your binary's compile definitions.

@Hetols
Copy link

Hetols commented Dec 4, 2023

I have also encountered a similar problem.
Ubuntu 22.04 with ROS2 Humble.

CmakeLists

cmake_minimum_required(VERSION 3.24)
project(project_name)

# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(TARGET_NAME ${PROJECT_NAME})
set(PCL_HOME /usr/local/pcl-1.13)

# Set compiler flags
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    add_compile_options(-Wall -Wextra -Wpedantic)
endif ()

# Find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(PCL 1.13 REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(laser_geometry REQUIRED)

# Set dependencies
set(dependencies
        PCL
        rclcpp
        std_msgs
        sensor_msgs
        laser_geometry
        pcl_conversions
)

# Include directories
include_directories(
        include
        ${PCL_INCLUDE_DIRS}
        ${rclcpp_INCLUDE_DIRS}
)

# Build executable
add_executable(main
        src/main.cpp)

# Link libraries
ament_target_dependencies(main ${dependencies})
target_link_libraries(main ${PCL_LIBRARIES})

MESSAGE(STATUS "PCL_VERSION: ${PCL_VERSION}")
MESSAGE(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}")
MESSAGE(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}")
MESSAGE(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}")

# Add definitions
add_definitions(${PCL_DEFINITIONS})
#add_definitions(-DEIGEN_HAS_CXX17_OVERALIGN=0)

# Install executable
install(TARGETS main
        RUNTIME DESTINATION lib/${PROJECT_NAME})
ament_package()

CmakeLog

-- Found ament_cmake: 1.3.6 (/opt/ros/humble/share/ament_cmake/cmake)
-- Found rclcpp: 16.0.7 (/opt/ros/humble/share/rclcpp/cmake)
-- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
-- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
-- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 6.1.1 (/opt/ros/humble/share/rmw_implementation_cmake/cmake)
-- Found rmw_fastrtps_cpp: 6.2.5 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
CMake Warning (dev) at /usr/local/pcl-1.13/share/pcl-1.13/Modules/FindFLANN.cmake:45 (find_package):
  Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT
  variables.  Run "cmake --help-policy CMP0144" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  CMake variable FLANN_ROOT is set to:

    /usr

  For compatibility, find_package is ignoring the variable, but code in a
  .cmake module might still use it.
Call Stack (most recent call first):
  /usr/local/pcl-1.13/share/pcl-1.13/PCLConfig.cmake:258 (find_package)
  /usr/local/pcl-1.13/share/pcl-1.13/PCLConfig.cmake:303 (find_flann)
  /usr/local/pcl-1.13/share/pcl-1.13/PCLConfig.cmake:567 (find_external_library)
  CMakeLists.txt:20 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Qhull version 8.0.2
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_2D
-- looking for PCL_GEOMETRY
-- looking for PCL_IO
-- looking for PCL_FEATURES
-- looking for PCL_ML
-- looking for PCL_SEGMENTATION
-- looking for PCL_VISUALIZATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_KEYPOINTS
-- looking for PCL_TRACKING
-- looking for PCL_RECOGNITION
-- looking for PCL_STEREO
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- looking for PCL_SIMULATION
-- Found pcl_conversions: 2.4.0 (/opt/ros/humble/share/pcl_conversions/cmake)
-- Found laser_geometry: 2.4.0 (/opt/ros/humble/share/laser_geometry/cmake)
-- PCL_VERSION: 1.13.1.99
-- PCL_LIBRARIES: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL
-- PCL_INCLUDE_DIRS: /usr/local/pcl-1.13/include/pcl-1.13;/usr/local/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2
-- PCL_DEFINITIONS: 
-- Configuring done (2.4s)
-- Generating done (0.0s)

Code

void lacerscan2pointcloud(const sensor_msgs::msg::LaserScan::SharedPtr &laser_msg, sensor_msgs::msg::PointCloud2 &cloud) {
    laser_geometry::LaserProjection laser_projection;
    laser_projection.projectLaser(*laser_msg, cloud);
}

Error

0x000055555556e3be in Eigen::internal::handmade_aligned_free (ptr=0x555555963a10) at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:118

/** \internal Frees memory allocated with handmade_aligned_malloc */
EIGEN_DEVICE_FUNC inline void handmade_aligned_free(void *ptr)
{
  if (ptr) {
    EIGEN_USING_STD(free)
    # SIGSEGV (Segmentation fault) in here.
    free(*(reinterpret_cast<void**>(ptr) - 1));
  }
}

@mvieth
Copy link
Member

mvieth commented Dec 6, 2023

@Hetols Can you provide a full backtrace, for example from valgrind or gdb? Do you build the laser_geometry package from source after you have installed your PCL build?

@Hetols
Copy link

Hetols commented Dec 7, 2023

I have also encountered a similar problem.
Ubuntu 22.04 with ROS2 Humble.
@mvieth I followed your suggestion and rebuilt the laser_geometry package, but the issue remains unresolved.

CmakeLists

Same as before

CmakeLog

-- Found ament_cmake: 1.3.6 (/opt/ros/humble/share/ament_cmake/cmake)
-- Found rclcpp: 16.0.7 (/opt/ros/humble/share/rclcpp/cmake)
-- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
-- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
-- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 6.1.1 (/opt/ros/humble/share/rmw_implementation_cmake/cmake)
-- Found rmw_fastrtps_cpp: 6.2.5 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.65.0") found components: system filesystem iostreams serialization 
CMake Warning (dev) at /usr/local/share/pcl-1.13/Modules/FindFLANN.cmake:45 (find_package):
  Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT
  variables.  Run "cmake --help-policy CMP0144" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  CMake variable FLANN_ROOT is set to:

    /usr

  For compatibility, find_package is ignoring the variable, but code in a
  .cmake module might still use it.
Call Stack (most recent call first):
  /usr/local/share/pcl-1.13/PCLConfig.cmake:258 (find_package)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:303 (find_flann)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:567 (find_external_library)
  CMakeLists.txt:21 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5") found components: CXX 
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Pcap: /usr/lib/x86_64-linux-gnu/libpcap.so  
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Qhull version 8.0.2
CMake Warning (dev) at /home/hetols/.local/share/JetBrains/Toolbox/apps/clion-nova/bin/cmake/linux/x64/share/cmake-3.27/Modules/FindOpenGL.cmake:381 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  /usr/local/share/pcl-1.13/PCLConfig.cmake:327 (find_package)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:567 (find_external_library)
  CMakeLists.txt:21 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found GLEW: /usr/include  
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_2D
-- looking for PCL_GEOMETRY
-- looking for PCL_IO
-- looking for PCL_FEATURES
-- looking for PCL_ML
-- looking for PCL_SEGMENTATION
-- looking for PCL_VISUALIZATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_KEYPOINTS
-- looking for PCL_TRACKING
-- looking for PCL_RECOGNITION
-- looking for PCL_STEREO
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- looking for PCL_SIMULATION
-- Found PCL_SIMULATION: /usr/local/lib/libpcl_simulation.so  
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL (Required is at least version "1.13.1") 
-- Found pcl_conversions: 2.4.0 (/opt/ros/humble/share/pcl_conversions/cmake)
-- Found laser_geometry: 2.6.0 (/usr/local/laser_geometry-ros2-2.6.0/share/laser_geometry/cmake)
-- PCL_VERSION: 1.13.1.99
-- PCL_LIBRARIES: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL
-- PCL_INCLUDE_DIRS: /usr/local/include/pcl-1.13;/usr/local/include/eigen3;/usr/include;/usr/include/pcl-1.12;/usr/include/ni;/usr/include/openni2
-- PCL_DEFINITIONS: -DEIGEN_HAS_CXX17_OVERALIGN=0
-- Configuring done (3.1s)
-- Generating done (0.0s)

Code

void lacerscan2pointcloud(const sensor_msgs::msg::LaserScan::SharedPtr &laser_msg, sensor_msgs::msg::PointCloud2 &cloud) {
    laser_geometry::LaserProjection laser_projection;
    laser_projection.projectLaser(*laser_msg, cloud);
}

Error

0x000055555556e3be in Eigen::internal::handmade_aligned_free (ptr=0x555555963a10) at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:118

/** \internal Frees memory allocated with handmade_aligned_malloc */
EIGEN_DEVICE_FUNC inline void handmade_aligned_free(void *ptr)
{
  if (ptr) {
    EIGEN_USING_STD(free)
    # SIGSEGV (Segmentation fault) in here.
    free(*(reinterpret_cast<void**>(ptr) - 1));
  }
}

GDB Info

GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from main...
(gdb) run
Starting program: /home/hetols/workspace/install/test/lib/test/main 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffeffff640 (LWP 8221)]
[New Thread 0x7fffef7fe640 (LWP 8222)]
[New Thread 0x7fffeeffd640 (LWP 8223)]
[New Thread 0x7fffee7fc640 (LWP 8224)]
[New Thread 0x7fffedffb640 (LWP 8225)]
[New Thread 0x7fffed7fa640 (LWP 8226)]
[New Thread 0x7fffecff9640 (LWP 8227)]
[New Thread 0x7fffec7f8640 (LWP 8228)]
[New Thread 0x7fffebff7640 (LWP 8229)]

Thread 1 "main" received signal SIGSEGV, Segmentation fault.
0x00007ffff4ca53fe in __GI___libc_free (mem=0x43a0) at ./malloc/malloc.c:3368
3368	  if (chunk_is_mmapped (p))                       /* release mmapped memory. */
(gdb) where
#0  0x00007ffff4ca53fe in __GI___libc_free (mem=0x43a0)
    at ./malloc/malloc.c:3368
#1  0x000055555557c81a in Eigen::internal::handmade_aligned_free (
    ptr=0x5555559c35c0)
    at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:118
#2  0x000055555557c887 in Eigen::internal::aligned_free (ptr=0x5555559c35c0)
    at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:206
#3  0x0000555555582ca6 in Eigen::internal::conditional_aligned_free<true> (
    ptr=0x5555559c35c0)
    at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:259
#4  0x0000555555587f8a in Eigen::internal::conditional_aligned_delete_auto<double, true> (ptr=0x5555559c35c0, size=2162)
    at /usr/local/include/eigen3/Eigen/src/Core/util/Memory.h:485
#5  0x0000555555582c69 in Eigen::DenseStorage<double, -1, -1, -1, 0>::~DenseStorage (this=0x7fffffffc618, __in_chrg=<optimized out>)
    at /usr/local/include/eigen3/Eigen/src/Core/DenseStorage.h:465
#6  0x000055555557cb44 in Eigen::PlainObjectBase<Eigen::Array<double, -1, -1, 0, -1, -1> >::~PlainObjectBase (this=0x7fffffffc618, __in_chrg=<optimized out>)
    at /usr/local/include/eigen3/Eigen/src/Core/PlainObjectBase.h:98
#7  0x000055555557cb64 in Eigen::Array<double, -1, -1, 0, -1, -1>::~Array (
    this=0x7fffffffc618, __in_chrg=<optimized out>)
    at /usr/local/include/eigen3/Eigen/src/Core/Array.h:45
#8  0x000055555557f616 in laser_geometry::LaserProjection::~LaserProjection (
--Type <RET> for more, q to quit, c to continue without paging--c
    this=0x7fffffffc610, __in_chrg=<optimized out>) at /usr/local/laser_geometry-ros2-2.6.0/include/laser_geometry/laser_geometry/laser_geometry.hpp:99
#9  0x0000555555575067 in laserscan2pointxyz (msg=std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >> (use count 1, weak count 0) = {...}, cloud=...) at /home/hetols/workspace/src/test/src/main.cpp:34
#10 0x000055555557513c in MainNode::topic_callback (this=0x55555570a5c0, msg=...) at /home/hetols/workspace/src/test/src/main.cpp:39
#11 0x00005555555cd284 in std::__invoke_impl<void, void (MainNode::*&)(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const, MainNode*&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&> (__f=@0x555555985cc0: (void (MainNode::*)(const MainNode * const, const sensor_msgs::msg::LaserScan_<std::allocator<void> > &)) 0x5555555750cc <MainNode::topic_callback(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>, __t=@0x555555985cd0: 0x55555570a5c0) at /usr/include/c++/11/bits/invoke.h:74
#12 0x00005555555ca87b in std::__invoke<void (MainNode::*&)(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const, MainNode*&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&> (__fn=@0x555555985cc0: (void (MainNode::*)(const MainNode * const, const sensor_msgs::msg::LaserScan_<std::allocator<void> > &)) 0x5555555750cc <MainNode::topic_callback(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>) at /usr/include/c++/11/bits/invoke.h:96
#13 0x00005555555c765e in std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>::__call<void, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, 0ul, 1ul>(std::tuple<sensor_msgs::msg::LaserScan_<std::allocator<void> > const&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x555555985cc0, __args=...) at /usr/include/c++/11/functional:420
#14 0x00005555555c3878 in std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>::operator()<sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, void>(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) (this=0x555555985cc0) at /usr/include/c++/11/functional:503
#15 0x00005555555be671 in std::__invoke_impl<void, std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&>(std::__invoke_other, std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) (__f=...) at /usr/include/c++/11/bits/invoke.h:61
#16 0x00005555555b7dd1 in std::__invoke_r<void, std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&>(std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const>&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) (__fn=...) at /usr/include/c++/11/bits/invoke.h:111
#17 0x00005555555aee45 in std::_Function_handler<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&), std::_Bind<void (MainNode::*(MainNode*, std::_Placeholder<1>))(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const> >::_M_invoke(std::_Any_data const&, sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) (__functor=..., __args#0=...) at /usr/include/c++/11/bits/std_function.h:290
#18 0x0000555555602c93 in std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>::operator()(sensor_msgs::msg::LaserScan_<std::allocator<void> > const&) const (this=0x555555985a58, __args#0=...) at /usr/include/c++/11/bits/std_function.h:590
#19 0x0000555555600b9f in rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}::operator()<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&>(std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&) const (__closure=0x7fffffffcb20, callback=...) at /opt/ros/humble/include/rclcpp/rclcpp/any_subscription_callback.hpp:544
#20 0x000055555560b789 in std::__invoke_impl<void, rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&>(std::__invoke_other, rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&) (__f=...) at /usr/include/c++/11/bits/invoke.h:61
#21 0x00005555556092ba in std::__invoke<rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&>(rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>&) (__fn=...) at /usr/include/c++/11/bits/invoke.h:96
#22 0x00005555556036cf in std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<std::__detail::__variant::__deduce_visit_result<void> (*)(rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&)>, std::integer_sequence<unsigned long, 0ul> >::__visit_invoke(rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&) (__visitor=..., __vars#0=std::variant<> [no contained value]) at /usr/include/c++/11/variant:1016
#23 0x0000555555603fc5 in std::__do_visit<std::__detail::__variant::__deduce_visit_result<void>, rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&>(rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&) (__visitor=...) at /usr/include/c++/11/variant:1727
#24 0x000055555560402c in std::visit<rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&>(rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)::{lambda(auto:1&&)#1}&&, std::variant<std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&)>, std::function<void (sensor_msgs::msg::LaserScan_<std::allocator<void> > const&, rclcpp::MessageInfo const&)>, std::function<void (rclcpp::SerializedMessage const&)>, std::function<void (rclcpp::SerializedMessage const&, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >)>, std::function<void (std::unique_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::default_delete<sensor_msgs::msg::LaserScan_<std::allocator<void> > > >, rclcpp::MessageInfo const&)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void (std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const>, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage const> const&, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >)>, std::function<void (std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> > >, rclcpp::MessageInfo const&)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void (std::shared_ptr<rclcpp::SerializedMessage>, rclcpp::MessageInfo const&)> >&) (__visitor=...) at /usr/include/c++/11/variant:1761
#25 0x0000555555600c76 in rclcpp::AnySubscriptionCallback<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> >::dispatch (this=0x555555985a58, message=std::shared_ptr<sensor_msgs::msg::LaserScan_<std::allocator<void> >> (use count 3, weak count 0) = {...}, message_info=...) at /opt/ros/humble/include/rclcpp/rclcpp/any_subscription_callback.hpp:504
#26 0x00005555555fdc83 in rclcpp::Subscription<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void>, sensor_msgs::msg::LaserScan_<std::allocator<void> >, sensor_msgs::msg::LaserScan_<std::allocator<void> >, rclcpp::message_memory_strategy::MessageMemoryStrategy<sensor_msgs::msg::LaserScan_<std::allocator<void> >, std::allocator<void> > >::handle_message (this=0x5555559858f0, message=std::shared_ptr<void> (use count 3, weak count 0) = {...}, message_info=...) at /opt/ros/humble/include/rclcpp/rclcpp/subscription.hpp:343
#27 0x00007ffff7dff7bc in rclcpp::Executor::execute_subscription(std::shared_ptr<rclcpp::SubscriptionBase>) () from /opt/ros/humble/lib/librclcpp.so
#28 0x00007ffff7dfffbf in rclcpp::Executor::execute_any_executable(rclcpp::AnyExecutable&) () from /opt/ros/humble/lib/librclcpp.so
#29 0x00007ffff7e078b0 in rclcpp::executors::SingleThreadedExecutor::spin() () from /opt/ros/humble/lib/librclcpp.so
#30 0x00007ffff7e07ac5 in rclcpp::spin(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>) () from /opt/ros/humble/lib/librclcpp.so
#31 0x00007ffff7e07bbf in rclcpp::spin(std::shared_ptr<rclcpp::Node>) () from /opt/ros/humble/lib/librclcpp.so
#32 0x0000555555575a90 in main (argc=1, argv=0x7fffffffdae8) at /home/hetols/workspace/src/test/src/main.cpp:114

@mvieth
Copy link
Member

mvieth commented Dec 7, 2023

@Hetols the backtrace suggests that the problem happens while freeing co_sine_map_ in LaserProjection ( https://github.com/ros-perception/laser_geometry/blob/humble/include/laser_geometry/laser_geometry.hpp#L198 ). laser_geometry seems to be compiled as C++14, so try compiling your own project as C++14 as well (instead of C++17). Alternatively, try compiling your project with -DEIGEN_HAS_CXX17_OVERALIGN=0. Did you compile PCL as C++14? (this is the default)
Oh, and I assume you used the humble branch of laser_geometry when building it from source?

@Hetols
Copy link

Hetols commented Dec 8, 2023

I have also encountered a similar problem.
Ubuntu 22.04 with ROS2 Humble.

@mvieth Previously, flag -DEIGEN_HAS_CXX17_OVERALIGN=0 was automatically added by add_definitions(${PCL_DEFINITIONS}), and I only set my own project to use C++17, while PCL, laser_geometry (using the ros2 branch, not humble), and some other dependencies used the default C++ standard. However, based on your advice, I tried to rebuild PCL, laser_geometry (using the humble branch), and my own project with C++14, but I still got the same error.

CmakeLists

cmake_minimum_required(VERSION 3.24)
project(virtual_lds)

# Set C++ standard
set(CMAKE_CXX_STANDARD 14)
set(TARGET_NAME ${PROJECT_NAME})

# Set compiler flags
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    add_compile_options(-Wall -Wextra -Wpedantic)
endif ()

# Find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(PCL 1.13 REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(laser_geometry HINTS "/usr/local/laser_geometry-humble-2.4.0")

# Set dependencies
set(dependencies
        PCL
        rclcpp
        std_msgs
        sensor_msgs
        laser_geometry
        pcl_conversions
)

# Include directories
include_directories(
        include
        ${PCL_INCLUDE_DIRS}
        ${rclcpp_INCLUDE_DIRS}
)

# Build executable
add_executable(main
        src/main.cpp)

# Link libraries
ament_target_dependencies(main ${dependencies})
target_link_libraries(main ${PCL_LIBRARIES})

MESSAGE(STATUS "PCL_VERSION: ${PCL_VERSION}")
MESSAGE(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}")
MESSAGE(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}")
MESSAGE(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}")

# Add definitions
add_definitions(${PCL_DEFINITIONS})

# Install executable
install(TARGETS main
        RUNTIME DESTINATION lib/${PROJECT_NAME})

# Install CMake config files
ament_package()

CmakeLog

-- Found ament_cmake: 1.3.6 (/opt/ros/humble/share/ament_cmake/cmake)
-- Found rclcpp: 16.0.7 (/opt/ros/humble/share/rclcpp/cmake)
-- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
-- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
-- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 6.1.1 (/opt/ros/humble/share/rmw_implementation_cmake/cmake)
-- Found rmw_fastrtps_cpp: 6.2.5 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
CMake Warning (dev) at /usr/local/share/pcl-1.13/Modules/FindFLANN.cmake:45 (find_package):
  Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT
  variables.  Run "cmake --help-policy CMP0144" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  CMake variable FLANN_ROOT is set to:

    /usr

  For compatibility, find_package is ignoring the variable, but code in a
  .cmake module might still use it.
Call Stack (most recent call first):
  /usr/local/share/pcl-1.13/PCLConfig.cmake:258 (find_package)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:303 (find_flann)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:567 (find_external_library)
  CMakeLists.txt:22 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Qhull version 8.0.2
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_2D
-- looking for PCL_GEOMETRY
-- looking for PCL_IO
-- looking for PCL_FEATURES
-- looking for PCL_ML
-- looking for PCL_SEGMENTATION
-- looking for PCL_VISUALIZATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_KEYPOINTS
-- looking for PCL_TRACKING
-- looking for PCL_RECOGNITION
-- looking for PCL_STEREO
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- looking for PCL_SIMULATION
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL (Required is at least version "1.13") 
-- Found pcl_conversions: 2.4.0 (/opt/ros/humble/share/pcl_conversions/cmake)
-- Found laser_geometry: 2.4.0 (/usr/local/laser_geometry-humble-2.4.0/share/laser_geometry/cmake)
-- PCL_VERSION: 1.13.1.99
-- PCL_LIBRARIES: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL
-- PCL_INCLUDE_DIRS: /usr/local/include/pcl-1.13;/usr/local/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2
-- PCL_DEFINITIONS: -DEIGEN_HAS_CXX17_OVERALIGN=0
-- Configuring done (2.7s)
-- Generating done (0.0s)

Code & Error & GDB Info

Same as before

@yumingdong
Copy link

yumingdong commented Feb 20, 2024

I have also encountered a similar problem. Ubuntu 22.04 with ROS2 Humble.

@mvieth Previously, flag -DEIGEN_HAS_CXX17_OVERALIGN=0 was automatically added by add_definitions(${PCL_DEFINITIONS}), and I only set my own project to use C++17, while PCL, laser_geometry (using the ros2 branch, not humble), and some other dependencies used the default C++ standard. However, based on your advice, I tried to rebuild PCL, laser_geometry (using the humble branch), and my own project with C++14, but I still got the same error.

CmakeLists

cmake_minimum_required(VERSION 3.24)
project(virtual_lds)

# Set C++ standard
set(CMAKE_CXX_STANDARD 14)
set(TARGET_NAME ${PROJECT_NAME})

# Set compiler flags
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    add_compile_options(-Wall -Wextra -Wpedantic)
endif ()

# Find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(PCL 1.13 REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(laser_geometry HINTS "/usr/local/laser_geometry-humble-2.4.0")

# Set dependencies
set(dependencies
        PCL
        rclcpp
        std_msgs
        sensor_msgs
        laser_geometry
        pcl_conversions
)

# Include directories
include_directories(
        include
        ${PCL_INCLUDE_DIRS}
        ${rclcpp_INCLUDE_DIRS}
)

# Build executable
add_executable(main
        src/main.cpp)

# Link libraries
ament_target_dependencies(main ${dependencies})
target_link_libraries(main ${PCL_LIBRARIES})

MESSAGE(STATUS "PCL_VERSION: ${PCL_VERSION}")
MESSAGE(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}")
MESSAGE(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}")
MESSAGE(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}")

# Add definitions
add_definitions(${PCL_DEFINITIONS})

# Install executable
install(TARGETS main
        RUNTIME DESTINATION lib/${PROJECT_NAME})

# Install CMake config files
ament_package()

CmakeLog

-- Found ament_cmake: 1.3.6 (/opt/ros/humble/share/ament_cmake/cmake)
-- Found rclcpp: 16.0.7 (/opt/ros/humble/share/rclcpp/cmake)
-- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
-- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
-- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 6.1.1 (/opt/ros/humble/share/rmw_implementation_cmake/cmake)
-- Found rmw_fastrtps_cpp: 6.2.5 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
CMake Warning (dev) at /usr/local/share/pcl-1.13/Modules/FindFLANN.cmake:45 (find_package):
  Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT
  variables.  Run "cmake --help-policy CMP0144" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  CMake variable FLANN_ROOT is set to:

    /usr

  For compatibility, find_package is ignoring the variable, but code in a
  .cmake module might still use it.
Call Stack (most recent call first):
  /usr/local/share/pcl-1.13/PCLConfig.cmake:258 (find_package)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:303 (find_flann)
  /usr/local/share/pcl-1.13/PCLConfig.cmake:567 (find_external_library)
  CMakeLists.txt:22 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so  found components: OpenGL GLX 
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /usr/include/openni2, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Qhull version 8.0.2
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_2D
-- looking for PCL_GEOMETRY
-- looking for PCL_IO
-- looking for PCL_FEATURES
-- looking for PCL_ML
-- looking for PCL_SEGMENTATION
-- looking for PCL_VISUALIZATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_KEYPOINTS
-- looking for PCL_TRACKING
-- looking for PCL_RECOGNITION
-- looking for PCL_STEREO
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- looking for PCL_SIMULATION
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL (Required is at least version "1.13") 
-- Found pcl_conversions: 2.4.0 (/opt/ros/humble/share/pcl_conversions/cmake)
-- Found laser_geometry: 2.4.0 (/usr/local/laser_geometry-humble-2.4.0/share/laser_geometry/cmake)
-- PCL_VERSION: 1.13.1.99
-- PCL_LIBRARIES: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL
-- PCL_INCLUDE_DIRS: /usr/local/include/pcl-1.13;/usr/local/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2
-- PCL_DEFINITIONS: -DEIGEN_HAS_CXX17_OVERALIGN=0
-- Configuring done (2.7s)
-- Generating done (0.0s)

Code & Error & GDB Info

Same as before

Have you solved this problem? I have encounter same problem, my develop environment is: Ubuntu 22.04 with ROS2 Humble pcl 1.12.1(install through apt install)
And when I use asan address tools , get following errors:
================================================================= ==191140==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00004e278 at pc 0x7f1a1afd1662 bp 0x7ffd1626ceb0 sp 0x7ffd1626cea0 READ of size 8 at 0x61d00004e278 thread T0 #0 0x7f1a1afd1661 in Eigen::internal::handmade_aligned_free(void*) /usr/include/eigen3/Eigen/src/Core/util/Memory.h:118 #1 0x7f1a1afd1661 in Eigen::internal::aligned_free(void*) /usr/include/eigen3/Eigen/src/Core/util/Memory.h:206 #2 0x7f1a1afd1661 in Eigen::aligned_allocator<pcl::PointXYZI>::deallocate(pcl::PointXYZI*, unsigned long) /usr/include/eigen3/Eigen/src/Core/util/Memory.h:921 #3 0x7f1a1afd1661 in std::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZI> >::deallocate(Eigen::aligned_allocator<pcl::PointXYZI>&, pcl::PointXYZI*, unsigned long) /usr/include/c++/11/bits/alloc_traits.h:345 #4 0x7f1a1afd1661 in std::_Vector_base<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::_M_deallocate(pcl::PointXYZI*, unsigned long) /usr/include/c++/11/bits/stl_vector.h:354 #5 0x7f1a1afd1661 in std::_Vector_base<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::~_Vector_base() /usr/include/c++/11/bits/stl_vector.h:335 #6 0x7f1a1afd1661 in std::vector<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::~vector() /usr/include/c++/11/bits/stl_vector.h:683 #7 0x7f1a1afd1661 in pcl::PointCloud<pcl::PointXYZI>::~PointCloud() /usr/include/pcl-1.12/pcl/point_cloud.h:172 #8 0x7f1a1afd1661 in std::_Sp_counted_ptr<pcl::PointCloud<pcl::PointXYZI>*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/include/c++/11/bits/shared_ptr_base.h:348 #9 0x7f1a1affc2a6 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/11/bits/shared_ptr_base.h:168 #10 0x7f1a1b033cad in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/11/bits/shared_ptr_base.h:705 #11 0x7f1a1b033cad in std::__shared_ptr<pcl::PointCloud<pcl::PointXYZI> const, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/11/bits/shared_ptr_base.h:1154 #12 0x7f1a1b033cad in std::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const>::~shared_ptr() /usr/include/c++/11/bits/shared_ptr.h:122 #13 0x7f1a1b033cad in pcl::Registration<pcl::PointXYZI, pcl::PointXYZI, float>::~Registration() /usr/include/pcl-1.12/pcl/registration/registration.h:137 #14 0x7f1a1b1efd75 in pcl::IterativeClosestPoint<pcl::PointXYZI, pcl::PointXYZI, float>::~IterativeClosestPoint() /usr/include/pcl-1.12/pcl/registration/icp.h:184 #15 0x7f1a1b1efd75 in station_detect_pkg::StationDetection::~StationDetection() /home/ymdong4/slam_code/iflytek_slam/localization_and_mapping/src/cartographer_ros/cartographer_ros/cartographer_ros/include/station_detection.h:45 #16 0x558adaea79c6 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/11/bits/shared_ptr_base.h:168 #17 0x558adae7a328 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/11/bits/shared_ptr_base.h:705 #18 0x558adae7a328 in std::__shared_ptr<station_detect_pkg::StationDetection, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/11/bits/shared_ptr_base.h:1154 #19 0x558adae7a328 in std::shared_ptr<station_detect_pkg::StationDetection>::~shared_ptr() /usr/include/c++/11/bits/shared_ptr.h:122 #20 0x558adae7a328 in main /home/ymdong4/slam_code/iflytek_slam/localization_and_mapping/src/cartographer_ros/cartographer_ros/cartographer_ros/src/station_detection_node.cpp:68 #21 0x7f1a0a3f5d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #22 0x7f1a0a3f5e3f in __libc_start_main_impl ../csu/libc-start.c:392 #23 0x558adae7a834 in _start (/home/ymdong4/slam_code/iflytek_slam/localization_and_mapping/install/lib/cartographer_ros/station_detection_node+0x69834) 0x61d00004e278 is located 8 bytes to the left of 2048-byte region [0x61d00004e280,0x61d00004ea80) allocated by thread T0 here: #0 0x7f1a1bd89887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f1a1127ea40 (/lib/x86_64-linux-gnu/libpcl_filters.so.1.12+0x55aa40) SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/include/eigen3/Eigen/src/Core/util/Memory.h:118 in Eigen::internal::handmade_aligned_free(void*) Shadow bytes around the buggy address: 0x0c3a80001bf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80001c00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80001c10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a80001c20: fd fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa 0x0c3a80001c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c3a80001c40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa] 0x0c3a80001c50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a80001c60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a80001c70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a80001c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c3a80001c90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc
@https://github.com/mvieth

@mvieth
Copy link
Member

mvieth commented Feb 21, 2024

@yumingdong Make sure that your code is compiled with AVX, AVX2, and AVX512 disabled, or try using #define PCL_NO_PRECOMPILE

@yumingdong
Copy link

@yumingdong Make sure that your code is compiled with AVX, AVX2, and AVX512 disabled, or try using #define PCL_NO_PRECOMPILE

I have use #define PCL_NO_PRECOMPILE macro in x86 PC can solve this problem, but in arm platform compile code supplys:
/../lib/gcc/aarch64-buildroot-linux-gnu/10.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: CMakeFiles/station_detection_node.dir/src/station_detection.cpp.o: undefined reference to symbol 'LZ4_compress_HC_continue' ../lib/gcc/aarch64-buildroot-linux-gnu/10.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: /home/jsxu4/rk3588_buildroot_toolchain/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib64/libflann_cpp.so.1.9: error adding symbols: DSO missing from command line
Can you solve this problem?

@TOMO-CAT
Copy link

@yumingdong Make sure that your code is compiled with AVX, AVX2, and AVX512 disabled, or try using #define PCL_NO_PRECOMPILE

add -DPCL_NO_PRECOMPILE=ON flags in x86 can also solve the double-free problem for me,could you please explain how it work? thans very much

here is my gdb backtrace:

image

Since I can't abstract the code into a minimum example yet, I would not show the code now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue
Projects
None yet
Development

No branches or pull requests

6 participants