免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2342 | 回复: 0
打印 上一主题 下一主题

Oprofile 交叉编译 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-02-07 10:30 |只看该作者 |倒序浏览

                由于OProfile需要在目标机上,所以需要交叉编译OProfile工具源码包:        oprofile-0.9.3.tar.gz编译工具:        arm-9tdmi-linux-gnu-gcc          arm-9tdmi-linux-gnu-g++步骤:        Cp oprofile-0.9.3.tar.gz  workdir        Tar zxvf oprofile-0.9.3.tar.gz        Cd oprofile-0.9.3                CC=arm-9tdmi-linux-gnu-gcc        CXX=arm-9tdmi-linux-gnu-g++                ./configure --with-kernel-support --target=arm-9tdmi-linux-gnu --host=arm-9tdmi-linux-gnu --build=i686-pc-linux-gnu --prefix=/work/OProfile/myOProfile                        [color="red"]现象:        创建Makefile文件,但是出现如下错误[color="red"](缺少popt库):        [root@localhost oprofile-0.9.3]# ./configure --with-kernel-support --target=arm-linux --host=arm-9tdmi-linux-gnu   --build=i686-pc-linux-gnu --prefix=/work/OProfile/myOProfile           checking for a BSD-compatible install... /usr/bin/install -c        checking whether build environment is sane... yes        checking for gawk... gawk        checking whether make sets $(MAKE)... yes        checking for arm-9tdmi-linux-gnu-strip... arm-9tdmi-linux-gnu-strip        checking for arm-9tdmi-linux-gnu-ranlib... arm-9tdmi-linux-gnu-ranlib        checking for arm-9tdmi-linux-gnu-gcc... arm-9tdmi-linux-gnu-gcc        checking for C compiler default output file name... a.out        checking whether the C compiler works... yes        checking whether we are cross compiling... yes        checking for suffix of executables...         checking for suffix of object files... o        checking whether we are using the GNU C compiler... yes        checking whether arm-9tdmi-linux-gnu-gcc accepts -g... yes        checking for arm-9tdmi-linux-gnu-gcc option to accept ANSI C... none needed        checking for style of include used by make... GNU        checking dependency style of arm-9tdmi-linux-gnu-gcc... gcc3        checking how to run the C preprocessor... arm-9tdmi-linux-gnu-gcc -E        checking for arm-9tdmi-linux-gnu-g++... arm-9tdmi-linux-gnu-g++        checking whether we are using the GNU C++ compiler... yes        checking whether arm-9tdmi-linux-gnu-g++ accepts -g... yes        checking dependency style of arm-9tdmi-linux-gnu-g++... gcc3        checking for ld... ld        checking for kernel OProfile support... yes        checking whether malloc attribute is understood... yes        checking whether __builtin_expect is understood... yes        checking for sched_setaffinity... yes        checking for perfmonctl... no        [color="red"]checking for poptGetContext in -lpopt... no        configure: error: popt library not found        [root@localhost oprofile-0.9.3]#                         [color="red"]解决方法:                可以知道交叉编译oprofile-0.9.3需要popt库,于是下载[color="red"]popt-1.7.tar.tar源码包        按下步骤                cd /root/projects/commen        tar xfz /root/tar/tools/popt-1.7.tar.gz        cd popt-1.7        CC=arm-linux-gcc ./configure ./configure --with-kernel-support --target=arm-9tdmi-linux-gnu --host=arm-9tdmi-linux-gnu --build=i686-pc-linux-gnu --prefix= /work/popt/poptinstall/        新手注意,当你看到源码目录下有configure文件时,都能使用这个方式来配置。        make        make install                cp  /work/popt/poptinstall/lib/*  /opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/arm-9tdmi-linux-gnu/lib                cp /work/popt/poptinstall/include/*   /opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu/arm-9tdmi-linux-gnu/include                具体参照:        
[color="#800080"]http://blog.csdn.net/wasid/archive/2005/12/22/559306.aspx
                                        [color="red"]现象:        然后再使用开始的配置命令为oprofile生成Makefile,[color="red"]popt库可以找到,但是这次缺少了bfd库                        CC=arm-9tdmi-linux-gnu-gcc        CXX=arm-9tdmi-linux-gnu-g++                [root@localhost oprofile-0.9.3]# ./configure --with-kernel-support --target=arm-9tdmi-linux-gnu  --host=arm-9tdmi-linux-gnu   --build=i686-pc-linux-gnu --prefix=/work/OProfile/myOProfile           checking for a BSD-compatible install... /usr/bin/install -c        checking whether build environment is sane... yes        checking for gawk... gawk        checking whether make sets $(MAKE)... yes        checking for arm-9tdmi-linux-gnu-strip... arm-9tdmi-linux-gnu-strip        checking for arm-9tdmi-linux-gnu-ranlib... arm-9tdmi-linux-gnu-ranlib        checking for arm-9tdmi-linux-gnu-gcc... arm-9tdmi-linux-gnu-gcc        checking for C compiler default output file name... a.out        checking whether the C compiler works... yes        checking whether we are cross compiling... yes        checking for suffix of executables...         checking for suffix of object files... o        checking whether we are using the GNU C compiler... yes        checking whether arm-9tdmi-linux-gnu-gcc accepts -g... yes        checking for arm-9tdmi-linux-gnu-gcc option to accept ANSI C... none needed        checking for style of include used by make... GNU        checking dependency style of arm-9tdmi-linux-gnu-gcc... gcc3        checking how to run the C preprocessor... arm-9tdmi-linux-gnu-gcc -E        checking for arm-9tdmi-linux-gnu-g++... arm-9tdmi-linux-gnu-g++        checking whether we are using the GNU C++ compiler... yes        checking whether arm-9tdmi-linux-gnu-g++ accepts -g... yes        checking dependency style of arm-9tdmi-linux-gnu-g++... gcc3        checking for ld... ld        checking for kernel OProfile support... yes        checking whether malloc attribute is understood... yes        checking whether __builtin_expect is understood... yes        checking for sched_setaffinity... yes        checking for perfmonctl... no        checking for poptGetContext in -lpopt... yes        checking for egrep... grep -E        checking for ANSI C header files... yes        checking for sys/types.h... yes        checking for sys/stat.h... yes        checking for stdlib.h... yes        checking for string.h... yes        checking for memory.h... yes        checking for strings.h... yes        checking for inttypes.h... yes        checking for stdint.h... yes        checking for unistd.h... yes        checking libiberty.h usability... no        checking libiberty.h presence... no        checking for libiberty.h... no        checking for cplus_demangle in -liberty... yes        checking for xcalloc... yes        checking for xmemdup... yes        checking for dlopen in -ldl... yes        checking for main in -lintl... no        [color="red"]checking for bfd_openr in -lbfd... no        configure: error: bfd library not found        [root@localhost oprofile-0.9.3]#                 [color="red"]解决方法:                找不到bfd源码包     郁闷        [color="red"]待解决……                阅读Oprofile manual, 确实是存在缺库的现象。 奇怪了,他们发现了怎么不给解决,苦了我了 :(                [color="red"]System requirements                Linux kernel 2.2/2.4                         OProfile uses a kernel module that can be compiled for 2.2.11 or later and 2.4. Versions 2.4.10 or above are recommended, and required if you use the boot-time kernel option nosmp. AMD Hammer support requires a recent (>= 2.4.19) kernel with the line EXPORT_SYMBOL(do_fork); present in kernel/ksyms.c. Such a kernel is present in the x86-64.org CVS repository. 2.5 kernels are supported with the in-kernel OProfile driver.                 modutils 2.4.6 or above                         You should have installed modutils 2.4.6 or higher (in fact earlier versions work well in almost all cases).                 Supported architecture                         For Intel IA32, a CPU with either a P6 generation or Pentium 4 core is required. In marketing terms this translates to anything between an Intel Pentium Pro (not Pentium Classics) and a Pentium 4 / Xeon, including all Celerons. The AMD Athlon, Duron, and Hammer CPUs are also supported. Other IA32 CPU types only support the RTC mode of OProfile; please see later in this manual for details. Hyper-threaded Pentium IVs are not supported in 2.4. For 2.4 kernels, the Intel IA-64 CPUs are also supported. For 2.5 kernels, there is additionally support for Alpha processors, and sparc64, ppc64, and PA-RISC in timer mode.                 Uniprocessor or SMP                         SMP machines are fully supported.                 [color="red"]Required libraries                         These libraries are required : popt, bfd, liberty (debian users: libiberty is provided in binutils-dev package), dl, plus the standard C++ libraries.                                                 Bash version 2                         The opcontrol script requires bash version 2 at least to be installed as /bin/bash or /bin/bash2                 OProfile GUI                         The use of the GUI to start the profiler requires the Qt 2 library. Qt 3 should also work.                 ELF                         Probably not too strenuous a requirement, but older A.OUT binaries/libraries are not supported.                 K&R coding style                         OK, so it's not really a requirement, but I wish it was...                 源文档
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/111072/showart_2179377.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP