Valgrind移植
發表時間:2020-10-19
發布人:葵宇科技
浏覽次數:79
Valgrind移植與應用教程
源碼版本:valgrind-3.16.1.tar.bz2
ubutun版本:20.04
交叉編譯鍊:arm-none-linux-gnueabi-
交叉編譯敕令介紹:
configure設備解釋解釋–build履行代碼編譯的主機–host法度榜樣最終要運行的主機–target用build主機上的編譯器(qì),編譯一個(gè)新的編譯器(qì)( 如(rú)gcc),這個(gè)新的編譯器(qì)将來編譯出來的其他法度榜樣将運行在target指定的體系上–prefix指定編譯出來的版本存放路(lù)徑,默認放在“/usr /local/bin”CC CXX CPP交叉編譯器(qì)設備CC=arm-none-linux-gnueabi-cc CPP=arm-none-linux-gnueabi-cpp CXX=arm-none-linux-gnueabi-g++安裝步調:
編譯linux版本
1.解壓并運行valgrind主動(dòng)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 文(wén)件:
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時可(kě)能會出現“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/今朝下(xià)文(wén)件複制到arm同級目次下(xià);
将/home/vmuser/valgrind-3.16.1/install_arm/bin/valgrind文(wén)件複制到/bin目次下(xià)。
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">