现象: 创建Makefile文件,但是出现如下错误(缺少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 checking for poptGetContext in -lpopt... no configure: error: popt library not found [root@localhost oprofile-0.9.3]#
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
[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 checking for bfd_openr in -lbfd... no configure: error: bfd library not found [root@localhost oprofile-0.9.3]#
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. 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...