在用make制作的锉刀上使用Valgrind
Using Valgrind on files made with make
我正试图在一个程序上使用valgrind,该程序是使用以下makefile的make命令的输出:
# Intlist makefile
P = intlist
C = g++
F = -m32 -g -O0 -Wall
O = IntListTest.o IntList.o
$(P): $(O)
$(C) $(F) -o $(P) $(O)
IntListTest.o: IntListTest.cpp IntList.h
$(C) $(F) -c IntListTest.cpp
IntList.o: IntList.cpp IntList.h
$(C) $(F) -c IntList.cpp
clean:
rm $(P) $(O)
当我在intlist上运行valgrind时,它会生成以下内容:
==130929== Memcheck, a memory error detector
==130929== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==130929== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==130929== Command: intlist
==130929==
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.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux.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.
我觉得我的makefile有什么问题,但我不确定是什么。任何想法都非常感谢。然而,这发生在一个大学拥有的服务器上,我没有安装任何东西的权限,所以这不是我的解决方案。
您正在构建一个32位可执行文件(编译/链接行中的-m32
选项(,但从valgrind提供的输出来看,您没有所有可用的支持库来在32位的可执行文件上运行valgrind。
你真的需要你的程序是32位吗?如果不是最简单的方法,那就是删除-m32
选项并清理和重建所有内容。
如果你真的必须有一个32位二进制文件,那么仔细阅读上面valgrind提供的输出,以确定你缺少哪些额外的32位库,需要安装。
相关文章:
- valgrind-hellgrind与泄漏检查的结果不同
- VS Code "command":"make"与终端窗口中的命令行"make"不同
- 额外分配valgrind
- 如何修复valgrind启动时的致命错误(与libc6-dbg和libc6-dbg:i386连接)
- 使用 make 编译 MPI,几个命名空间错误,例如"错误:未知类型名称'使用'?
- make 命令如何避免重新编译未更改的源文件?
- MAKE:找不到包含的用户定义的头文件?
- 'make check' GLIBC 运行时的链接问题
- Valgrind:可以处理更多可能丢失的字节吗?
- 如何在程序执行时查看Valgrind Massif输出(或其他堆分析器)?
- C++/Qt Valgrind 未初始化的字节
- 在 valgrind c++ 上读取大小 8 无效
- 了解 Linux 虚拟内存:valgrind 的 massif 输出显示了有和没有 --pages-as-heap 的主要差异
- Valgrind 在 std::string::swap 中报告 SIGILL
- Valgrind 大小为 8 且地址 0x5b7e520 的读取无效,在大小为 16 的块内为 0 字节 free'd
- Qt5 [make -snap] 无法正确编译:进程"/usr/bin/snap"代码 1 退出
- 重载 new 和 delete 会导致 valgrind 错误
- Valgrind 在 QThread::start() 上报告内存泄漏
- 我可以让 valgrind 告诉我 _哪个_值未初始化吗?
- mingw32-make 使用"MinGW Makefiles"生成器跟踪 CMAKE 无法将可执行文件链接到对象库