Valgrind编译安装(海思平台)

造成内存泄漏的原因有几个,具体的原因分析可以自行百度,这里主要分析malloc和free不匹配造成的。 这里用Valgrind这个工具来排查。 主要是讲一下载海思平台上安装这个工具。

我首先按照网上的方法来安装出现以下问题,如果你们也出现 这个问题,可以试一下我的方法

valgrind-m_debuglog.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:2818: recipe for target 'valgrind' failed
make[3]: *** [valgrind] Error 1
make[3]: Leaving directory '/var/valgrind-3.15.0/coregrind'
Makefile:1915: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/var/valgrind-3.15.0/coregrind'
Makefile:842: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/valgrind-3.15.0'
Makefile:711: recipe for target 'all' failed
make: *** [all] Error 2

工具大家可以自行百度下载,之后我找到自己的压缩包再上传吧!下面是安装步骤

1、把压缩包拷贝到Ubuntu上解压

2、解压之后进入解压的目录,在正式安装之前需要先安装automake。如果Ubuntu可以上网可以直接apt-get install automake来安装,否则就只能下载压缩包解压来解决。

3、进入解压目录之后有一个config文件,在linux下安装过软件都知道这个是安装配置文件, 这里要用在arm平台,所以需要做一下修改。vi config 把armv7*)修改成armv7*|arm)。这个可以直接搜索。进入vi之后先不要插入,输入/armv7,回车就可以

4、配置环境变量 

    export CC=arm-hisiv500-linux-gcc

    export AR=arm-hisiv500-linux-ar

    export LD=arm-hisiv500-linux-ld

5、./configure --host=arm-hisiv500-linux --prefix=/nfs/valgrind/ --enable-only32bit

最后的--enable-only32bit是你平台是32位还是64位,看自己的情况

6、make;make install

7、安装之后在coregrind目录里有一个valgrind程序,拷贝到单板上就可以使用

至于使用的话,我们公司的工程太乱了,没办法用这个工具来排查, 所以我就没有使用,具体的使用方法可以参考其他人的博客

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值