Arch Linux下Valgrind启动触发致命错误求助
Arch Linux下Valgrind启动报错的解决方案
我在Arch Linux中通过以下命令安装Valgrind:
sudo pacman -S valgrind
运行时出现如下报错:
==3821== Memcheck, a memory error detector ==3821== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==3821== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info ==3821== Command: ls ==3821== 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: strcmp 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 package you need valgrind: to install for fix (1) is called valgrind: valgrind: On Debian, Ubuntu: libc6-dbg valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo valgrind: valgrind: Note that if you are debugging a 32 bit process on a valgrind: 64 bit system, you will need a corresponding 32 bit debuginfo valgrind: package (e.g. libc6-dbg:i386). valgrind: valgrind: Cannot continue -- exiting now. Sorry.
已尝试操作:
- 重启系统
- 配置DEBUGINFOD_URLS环境变量,当前输出:
echo $DEBUGINFOD_URLS https://debuginfod.archlinux.org
debuginfod安装信息:
Installed From : None Name : debuginfod Version : 0.191-3 Description : Handle ELF object files and DWARF debugging information (debuginfod) Architecture : x86_64 URL : https://sourceware.org/elfutils/ Licenses : GPL-3.0-or-later Groups : None Provides : None Depends On : gcc-libs glibc libarchive libarchive.so=13-64 libelf=0.191 libmicrohttpd libmicrohttpd.so=12-64 sqlite libsqlite3.so=0-64 Optional Deps : elfutils=0.191: for translations Required By : valgrind Optional For : binutils Conflicts With : None Replaces : None Installed Size : 339.33 KiB Packager : Frederik Schwan <freswa@archlinux.org> Build Date : Tue May 7 18:21:08 2024 Install Date : Thu Jun 27 01:21:43 2024 Install Reason : Installed as a dependency for another package Install Script : No Validated By : Signature
Valgrind安装信息:
Installed From : extra Name : valgrind Version : 3.23.0-4 Description : Tool to help find memory-management problems in programs Architecture : x86_64 URL : https://valgrind.org/ Licenses : GPL-2.0-or-later Groups : None Provides : valgrind-multilib Depends On : glibc perl debuginfod Optional Deps : lib32-glibc: 32-bit ABI support [installed] python: cg_* scripts [installed] Required By : None Optional For : None Conflicts With : None Replaces : valgrind-multilib Installed Size : 67.46 MiB Packager : Frederik Schwan <freswa@archlinux.org> Build Date : Tue May 7 18:04:05 2024 Install Date : Thu Jun 27 08:55:25 2024 Install Reason : Explicitly installed Install Script : No Validated By : Signature
可行解决方案
方法一:安装glibc调试包(推荐)
Arch Linux的调试包位于专用调试仓库,需先启用:
- 编辑
/etc/pacman.conf,取消以下两行的注释(若存在):
[core-debug] Include = /etc/pacman.d/mirrorlist [extra-debug] Include = /etc/pacman.d/mirrorlist
- 更新pacman数据库:
sudo pacman -Sy
- 安装64位glibc调试包:
sudo pacman -S glibc-debug
- 若需调试32位程序,同时安装:
sudo pacman -S lib32-glibc-debug
- 重新运行Valgrind验证:
valgrind ls
方法二:确保DEBUGINFOD环境变量全局生效
如果依赖debuginfod自动拉取调试信息,需确保环境变量在所有会话中生效:
- 将DEBUGINFOD_URLS写入shell配置文件(如/.bashrc或/.zshrc):
echo 'export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"' >> ~/.bashrc
- 重载配置文件:
source ~/.bashrc
- 重新运行Valgrind,等待debuginfod自动下载所需调试信息。
内容的提问来源于stack exchange,提问作者Victor fernandes
相关产品推荐
相关产品推荐

