OpenEuler 安装 valgrind 有关的二三事

项目场景:

程序跑在离线的开发板上,新功能频繁导致导致崩溃,报错信息无法准确定位到实际出问题的位置,加太多打印也不现实,考虑使用 valgrind 进行调试。


软件安装

Valgrind

官方版本:Current Releases
OpenEuler 版本: src-openEuler/valgrind

安装流程参考以下命令

$ mkdir /tmp/valgrind
$ cp valgrind-3.22.0.tar.bz2 /tmp/valgrind/
$ cd /tmp/valgrind
$ bzip2 -d valgrind-3.22.0.tar.bz2 
$ tar -xf valgrind-3.22.0.tar.bz2 
$ cd valgrind-3.22.0
$ ./configure && make
$ sudo make install

安装完成尝试调试程序的时候我们很可能见到这样的错误提示

==21276== Memcheck, a memory error detector
==21276== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==21276== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==21276== Command: ls
==21276== 

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:  
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:  
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The packa
### 龙芯架构上安装 ROS2 的方法 要在 LoongArch 架构的龙芯处理器上成功部署 ROS2 框架,需综合考虑其软件栈的支持情况以及可能存在的兼容性和依赖项问题。以下是针对该场景的技术分析和解决方案。 #### 1. **环境准备** 由于 LoongArch 是一种较新的指令集架构,许多开源项目尚未完全适配此架构。因此,首要任务是确认基础工具链(如 kernel、glibc 和编译器)已支持 LoongArch[^1]。 如果 openEuler Embedded Linux 已经支持龙芯架构,则可以选择它作为目标操作系统的发行版[^2]。确保所选版本能够稳定运行于龙芯平台,并具备必要的包管理工具(如 `dnf` 或 `apt`),以便后续安装依赖库。 #### 2. **依赖项解决** ROS2 运行需要一系列核心依赖库,包括但不限于: - Python3 及 pip - Colcon 构建工具 - Fast DDS 或 Cyclone DDS 中间件 - Eigen 库和其他 C++ 数学库 这些依赖通常可以通过交叉编译或者直接在目标平台上构建来获取。然而需要注意的是,在异构系统中可能会遇到 ABI 不匹配等问题[^3]。建议优先尝试官方二进制发布包是否适用于当前硬件平台;如果不适用,则应手动重新编译所有相关组件以适应本地架构特性。 #### 3. **源码编译流程** 当无法找到预编译好的 ROS2 发行版时,可以从上游仓库克隆最新代码并自行完成整个过程: ```bash sudo apt update && sudo apt install curl gnupg2 lsb-release curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2-latest.list > /dev/null sudo apt update sudo apt install python3-colcon-common-extensions python3-argcomplete libtinyxml2-dev libcunit1-dev libconsole-bridge-dev libpoco-dev build-essential cmake git wget pkg-config python3-pip python3-setuptools python3-wheel ninja-build clang-format-9 doxygen graphviz cppcheck valgrind lcov gcovr qtbase5-dev pyqt5-dev-tools sip-dev PyQt5-sip-dev python3-catkin-pkg-modules python3-osrf-pycommon ros-$DISTRO-rmw-cyclonedds-cpp ros-$DISTRO-demo-nodes-cpp ros-$DISTRO-turtlesim mkdir -p ~/ros2_ws/src cd ~/ros2_ws/ wget https://github.com/ros2/ros2/releases/download/release-foxy-20230718/ros2-foxy-linux-loongarch.tar.bz2 tar xfj ros2-foxy-linux-loongarch.tar.bz2 source local_setup.bash colcon build --symlink-install ``` 上述脚本假设存在一个已经过移植调整后的 Foxy Fitzroy 版本 tarball 文件可用作初始起点[^4]。实际执行过程中还需根据具体情况进行适当修改。 #### 4. **测试验证** 最后一步是对新搭建起来的 ROS2 环境进行全面的功能性检测。启动几个简单的节点程序观察它们能否正常通讯交流即可初步判断整体状况良好与否。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值