Valgrind移植
发表时间:2020-10-19
发布人:葵宇科技
浏览次数:116
Valgrind移植与应用教程
源码版本:valgrind-3.16.1.tar.bz2
ubutun版本:20.04
交叉编译链:arm-none-linux-gnueabi-
交叉编译敕令介绍:
configure设备解释解释–build履行代码编译的主机–host法度榜样最终要运行的主机–target用build主机上的编译器,编译一个新的编译器( 如gcc),这个新的编译器将来编译出来的其他法度榜样将运行在target指定的体系上–prefix指定编译出来的版本存放路径,默认放在“/usr /local/bin”CC CXX CPP交叉编译器设备CC=arm-none-linux-gnueabi-cc CPP=arm-none-linux-gnueabi-cpp CXX=arm-none-linux-gnueabi-g++安装步调:
编译linux版本
1.解压并运行valgrind主动make脚本
vmuser@vmuser-virtual-machine:tar jxvf valgrind-3.16.1.tar.bz2
vmuser@vmuser-virtual-machine:~/valgrind-3.16.1$ sudo apt-get install automake
vmuser@vmuser-virtual-machine:~/valgrind-3.16.1$ ./autogen.sh
2.configure
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ mkdir install
vmuser@vmuser-virtual-machine:~/valgrind-3.16.1$ ./configure --prefix=/home/vmuser/valgrind-3.16.1/install/
3.make
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ make
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ make install
编译ARM版本
1.编译之前先make clean
2.修改 configure 文件:
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ mkdir install_arm
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ ./configure --host=arm-linux CC=arm-none-linux-gnueabi-cc CPP=arm-none-linux-gnueabi-cpp CXX=arm-none-linux-gnueabi-g++ --prefix= --prefix=/home/vmuser/valgrind-3.16.1/install_arm/
报错
checking host system type... arm-unknown-linux-gnu
checking for a supported CPU... no (arm)
configure: error: Unsupported host architecture. Sorry
修改configure 把armv7a* 改为 arm* 再次设备configure
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ ./configure --host=arm-linux CC=arm-none-linux-gnueabi-cc CPP=arm-none-linux-gnueabi-cpp CXX=arm-none-linux-gnueabi-g++ --prefix= --prefix=/home/vmuser/valgrind-3.16.1/install_arm/
//留意:–prefix=/mnt指定的目次要与开辟板上放置的目次一致,不然运行valgrind时可能会出现“valgrind: failed to start tool ‘memcheck’ for platform ‘arm-Linux’: No such file or directory”缺点。
3.编译安装
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ make
vmuser@vmuser-virtual-machine:~/valgrimakend-3.16.1$ make install
4.移植到arm开辟板
将/home/vmuser/valgrind-3.16.1/install_arm/今朝下文件复制到arm同级目次下;
将/home/vmuser/valgrind-3.16.1/install_arm/bin/valgrind文件复制到/bin目次下。
root@freescale /home/vmuser/valgrind-3.16.1$ valgrind --help
usage: valgrind [options] prog-and-args
tool-selection option, with default in [ ]:
--tool=<name> use the Valgrind tool named <name> [memcheck]
basic user options for all Valgrind tools, with defaults in [ ]:
-h --help show this message
--help-debug show this message, plus debugging options
--help-dyn-options show the dynamically changeable options
--version show version
-q --quiet run silently; rel="stylesheet">