gpt4 book ai didi

c++ - 在 ARM 处理器上运行 pcl::MovingLeastSquares 代码时双重释放或损坏运行时错误

转载 作者:行者123 更新时间:2023-11-30 04:06:36 24 4
gpt4 key购买 nike

我在运行 Ubuntu 13.04 的 ARM 处理器上运行移动最小二乘代码时遇到运行时问题,从 github 手动编译最新的 pcl 1.7.2。

在第266行有一个double free错误导致崩溃表面/包含/pcl/表面/impl/mls.hpp

其他相关包:

  • LibBoost 版本 1.49.0.1

  • FLANN 版本 1.7.1-4

  • 本征 3.1.2-1

相同的代码可以在普通 PC(64 位 Ubuntu 12.04)上正确运行。

我抓取并修改了以下代码: http://pointclouds.org/documentation/tutorials/resampling.php

这是我最终运行的基本代码:

#include <pcl/point_types.h> 
#include <pcl/point_cloud.h>
#include <pcl/io/pcd_io.h>

#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/surface/mls.h>

using namespace pcl;
using namespace pcl::io;

// ######################################################################
int main(int argc, char **argv)
{
// Load input file into a PointCloud<T> with an appropriate type
PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ> ());
pcl::io::loadPCDFile (argv[1], *cloud);

// Create a KD-Tree
pcl::search::KdTree<PointXYZ>::Ptr
tree (new pcl::search::KdTree<PointXYZ>);

// Output has the PointNormal type
// in order to store the normals calculated by MLS
PointCloud<PointNormal> mls_points;

// Init object (second point type is for the normals, even if unused)
pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;

mls.setComputeNormals (true);

// Set parameters
mls.setInputCloud (cloud);
mls.setPolynomialFit (true);
mls.setSearchMethod (tree);
mls.setSearchRadius (0.03);

// Reconstruct CRASH IN LINE BELOW
mls.process (mls_points);

return EXIT_SUCCESS;
}

下面是 gdb 跟踪。代码在 mls.process 行中崩溃:

randall@odroid:~/pcl_project/build$ gdb --args ../bin/a.out ~/Downloads/pcl-master1.7.2/test/bun0.pcd 
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 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 "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/randall/pcl_project/bin/a.out ...done.
(gdb) run
Starting program: /home/randall/pcl_project/bin/a.out /home/randall/Downloads/pcl-master1.7.2/test/bun0.pcd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xaee3e328 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) c
Continuing.
Cannot access memory at address 0x0
*** Error in `/home/randall/pcl_project/bin/a.out': double free or corruption (out): 0x002f1900 ***

Program received signal SIGABRT, Aborted.
__libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:44
44 ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or directory.
(gdb) bt
#0 __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:44
#1 0xb2d8b5fe in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2 0xb2d8de1a in __GI_abort () at abort.c:90
#3 0xb2db19ec in __libc_message (do_abort=2, fmt=0xb2e307c0 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:199
#4 0xb2db8752 in malloc_printerr (action=3, str=0xb2e30938 "double free or corruption (out)", ptr=<optimized out>) at malloc.c:4923
#5 0xb2db9192 in _int_free (av=<optimized out>, p=0x2f18f8, have_lock=0) at malloc.c:3779
#6 0xb36b61e2 in aligned_free (ptr=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/util/Memory.h:227
#7 conditional_aligned_free<true> (ptr=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/util/Memory.h:299
#8 conditional_aligned_delete_auto<double, true> (ptr=<optimized out>, size=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/util/Memory.h:425
#9 ~DenseStorage (this=0xbeffe148, __in_chrg=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:200
#10 ~PlainObjectBase (this=0xbeffe148, __in_chrg=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:72
#11 ~Matrix (this=0xbeffe148, __in_chrg=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/Matrix.h:127
#12 ~LLT (this=0xbeffe148, __in_chrg=<optimized out>) at /usr/include/eigen3/Eigen/src/Cholesky/LLT.h:50
#13 pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal>::computeMLSPointNormal (this=this@entry=0xbeffe5e0, index=0, nn_indices=..., nn_sqr_dists=...,
projected_points=..., projected_points_normals=..., corresponding_input_indices=..., mls_result=...)
at /home/randall/Downloads/pcl-master1.7.2/surface/include/pcl/surface/impl/mls.hpp:266
#14 0xb36b6d78 in pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal>::performProcessing (this=0xbeffe5e0, output=...)
at /home/randall/Downloads/pcl-master1.7.2/surface/include/pcl/surface/impl/mls.hpp:489
#15 0xb36860d2 in pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal>::process (this=0xbeffe5e0, output=...)
at /home/randall/Downloads/pcl-master1.7.2/surface/include/pcl/surface/impl/mls.hpp:133
#16 0x001d28c4 in main (argc=2, argv=0xbefff1a4) at /home/randall/pcl_project/src/main.C:67

提前谢谢你。

最佳答案

根据 Nizar Sallem 的建议,我禁用了向量化(将它设置为 0,比如在 pcl_config.h 中,因为几乎每个地方都包含那个)在 Debug模式下。==> http://www.pcl-users.org/double-free-or-corruption-error-in-pcl-MovingLeastSquares-on-ARM-processor-td4033241.html#a4033425

这是我做的:

我添加到pcl-master1.7.2/CMakeList.txt

add_definitions(-DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT 
-DEIGEN_DONT_VECTORIZE)
add_definitions(-DEIGEN_DONT_ALIGN)

在 Eigen 的定义之后:

# Eigen (required) 
find_package(Eigen REQUIRED)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
add_definitions(-DEIGEN_USE_NEW_STDVECTOR
-DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET)

我也加入了pcl_config.h.in

#define EIGEN_DONT_VECTORIZE 1 
#define EIGEN_DONT_ALIGN 1

第 15 行之后:

#define PCL_VERSION_COMPARE(OP,MAJ,MIN,PATCH) \
(PCL_VERSION OP PCL_VERSION_CALC(MAJ,MIN,PATCH))

这两个添加中的一个或两个都可以解决问题。

关于c++ - 在 ARM 处理器上运行 pcl::MovingLeastSquares 代码时双重释放或损坏运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22825794/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com