MIPS平台目标机安装Oprofile时出现error

来源:互联网 发布:linux硬盘信息 编辑:程序博客网 时间:2024/05/20 21:20

在Debian下安装Oprofile

重要:应该使linux内核选项支持

.config 文件中设置CONFIG_PROFILING=yCONFIG_OPROFILE=y。

重新编译,烧写。使用apt-get update && apt-get install oprofile oprofile-gui

或手工安装直接从网上下载oprofile-0.9.8。

Oprofile默认需要这些库的支持: 由GNUmaintain的libbfd.so及libiberty.so

编译和安装最新的biutils工具集。binutils-2.22.tar.gz.

在 /usr/local/lib/ 目录下生成静态库 libbfd.a和libiberty.a。
但oprofile需要动态库,所以需要修改oprofile/libopangent/Makefile文件使之支持静态库。
修改如下:
BFD_LIBS = -lbfd -liberty -ldl -lz => BFD_LIBS = -static-libbfd -static-libiberty -ldl -lz
其他的可修改
如果linux kernel 版本是2.6.35+,应该会出现以下错误:
operf_utils.cpp:735: error: ‘PERF_RECORD_MISC_GUEST_KERNEL’ was not declared in this scope
operf_utils.cpp:738: error: ‘PERF_RECORD_MISC_GUEST_USER’ was not declared in this scope
参考文件/usr/include/linux/perf_event.h
把 ‘PERF_RECORD_MISC_GUEST_KERNEL’ 改成‘PERF_RECORD_MISC_KERNEL’,
     ‘PERF_RECORD_MISC_GUEST_USER’ 改成 ‘PERF_RECORD_MISC_USER’ .
 即可成功编译。
 
另外在X86平台安装oprofile-0.9.9遇到的错误:
../include/sstream:37: error: using typedef-name âstd::stringbufâ after âclassâ(http://marc.info/?l=oprofile-list&m=121841939525369)
这是因为之前已经自动安装了oprofile-0.9.7版本,所以只需删掉以前的oprofile版本,安装重复以上步骤即可