gperftools 移植到arm

1.https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz

2.tar zxvf 进行解压

3.cd gperftools-2.0

4../configure --prefix=/home/luxq/arm_lib --host=arm-avl11hardfp-linux-gnueabi

5.make时报错,需修改源代码。

(1)报错selected processor does not support arm mode ’dmb‘

修改src/base/atomicops-internals-arm-v6plus.h文件
查找MemoryBarrier,修改之后内容如下
inline void MemoryBarrier() {
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6KZ__) || defined(__ARM_ARCH_6T2__)
uint32_t dest = 0;
__asm__ __volatile__("mcr p15,0,%0,c7,c10,5" :"=&r"(dest) : : "memory");
#else
__asm__ __volatile__("mcr p15,0,%0,c7,c10,5" :"=&r"(dest) : : "memory");
//源代码修改是下面这行,但是我依然报错arm ‘dmb’,所以我把下面这行也注掉了,使用上面的代码。
//__asm__ __volatile__("dmb" : : : "memory");
#endif
}

修改 src/base/basictypes.h文件
查找 CACHELINE_ALIGNED
在这块代码中进行修改,修改之后如下
# define CACHELINE_ALIGNED __attribute__((aligned(64)))
# elif (defined(__PPC__) || defined(__PPC64__))
# define CACHELINE_ALIGNED __attribute__((aligned(16)))
# elif (defined(__arm__))
# define CACHELINE_ALIGNED __attribute__((aligned(64)))
// some ARMs have shorter cache lines (ARM1176JZF-S is 32 bytes for example) but obviously 64-byte aligned implies 32-byte aligned
# else
# error Could not determine cache line length - unknown architecture
# define CACHELINE_ALIGNED
# endif

(2)报错src/system-alloc.cc:270:3: error: ‘failed_’ was not declared in this scope

前辈说:原因是用虚拟机导致的,主要见于virtualbox,是因为操作系统不支持MMAP引起的。

修改src/config.h 这个文件是configure之后自动生成的,所以configure一次就要改一次
查找HAVE_MMAP
#define HAVE_MMAP 1

6.make 成功,make install再成功,完成。

最后,由于pprof是perl 脚本,所以还需要移植perl,才能在板子上使用。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值