交叉编译器:arm-linux-gnueabihf
valgrind:V3.21.0
一、移植
修改configure
将armv7*改成arm*,否则会导致编译错误:configure: error: Unsupported host architecture. Sorry
配置文件
./configure CC=arm-linux-gnueabihf-gcc CPP=arm-linux-gnueabihf-cpp CXX=arm-linux-gnueabihf-g++ --host=arm-linux --prefix=/opt/valgrind
编译
make -j4
sudo make install
移植
删除/opt/valgrind下的share/和include/两个文件夹,将/opt/valgrind拷贝到开发板的/opt目录下
修改/etc/profile,PATH添加/opt/valgrind/bin,并在末尾添加
export VALGRIND_LIB=/opt/valgrind/libexec/valgrind
保存退出,source /etc/profile运行环境
修改ld-linux-armhf.so.3的链接,将交叉编译器ld-linux-armhf.so.3指向的动态库拷贝到开发板的/lib目录下,修改软连接
ln -snf XXXX.so ld-linux-armhf.so.3
运行测试 valgrind --tool=memcheck --leak-check=full ./test