全部博文(135)
2010年(135)
分类: LINUX
2010-02-07 10:31:46
OProfile编译续
昨天交叉编译了popt库,并且拷贝到了交叉编译器下的lib目录下,
由于bfd和liberty库存在于binutils-dev库中,所以直接就交叉编译binutils-dev源码。
本来以为把bfd和liberty库和相应的头文件都拷贝到交叉编译器下面的include和lib目录下,
然后执行:
./configure --with-kernel-support --target=arm-9tdmi-linux-gnu --host=arm-9tdmi-linux-gnu --build=i686-pc-linux-gnu --prefix=/work/OProfile/myOProfile
就可以生成Makefile文件了。但是结果是还是找不到bfd库。
后来察看./configure --help
[root@localhost oprofile-0.9.3]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help
display this help and exit
--help=short
display options specific to this package
--help=recursive
display the short help of all the included packages
-V, --version
display version information and exit
-q, --quiet, --silent
do not print `checking...' messages
--cache-file=FILE
cache test results in FILE [disabled]
-C, --config-cache
alias for `--cache-file=config.cache'
-n, --no-create
do not create output files
--srcdir=DIR
find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX
install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX
install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR
user executables [EPREFIX/bin]
--sbindir=DIR
system admin executables [EPREFIX/sbin]
--libexecdir=DIR
program executables [EPREFIX/libexec]
--datadir=DIR
read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR
read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR
modifiable single-machine data [PREFIX/var]
--libdir=DIR
object code libraries [EPREFIX/lib]
--includedir=DIR
C header files [PREFIX/include]
--oldincludedir=DIR
C header files for non-gcc [/usr/include]
--infodir=DIR
info documentation [PREFIX/info]
--mandir=DIR
man documentation [PREFIX/man]
Program names:
--program-prefix=PREFIX
prepend PREFIX to installed program names
--program-suffix=SUFFIX
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
X features:
--x-includes=DIR
X include files are in DIR
--x-libraries=DIR
X library files are in DIR
Optional Features:
--disable-FEATURE
do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG]
include FEATURE [ARG=yes]
--disable-dependency-tracking
speeds up one-time build
--enable-dependency-tracking
do not reject slow dependency extractors
--enable-pch
enable precompiled header (default is disabled)
--enable-gcov
enable option for gcov coverage testing (default is disabled)
--disable-werror
disable -Werror flag (default is enabled for non-release)
--disable-optimization
disable optimization flags (default is enabled)
Optional Packages:
--with-PACKAGE[=ARG]
use PACKAGE [ARG=yes]
--without-PACKAGE
do not use PACKAGE (same as --with-PACKAGE=no)
--with-binutils=dir
Path to binutils installation to use
--with-gcc=dir
Path to GCC installation to use
--with-kernel-support
Use 2.6 kernel (no kernel source tree required)
--with-linux=dir
Path to Linux source tree
--with-module-dir=dir
Path to module installation directory
--with-extra-includes=DIR
add extra include paths
--with-extra-libs=DIR
add extra library paths
--with-x
use the X Window System
--with-qt-dir
where the root of Qt is installed
--with-qt-includes
where the Qt includes are.
--with-qt-libraries
where the Qt library is installed.
--with-target=cell-be Check BFD support for Cell Broadband Engine SPU profiling
Some influential environment variables:
CC
C compiler command
CFLAGS
C compiler flags
LDFLAGS
linker flags, e.g. -L
CPPFLAGS
C/C++ preprocessor flags, e.g. -I
CPP
C preprocessor
CXX
C++ compiler command
CXXFLAGS
C++ compiler flags
CXXCPP
C++ preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
[root@localhost oprofile-0.9.3]#
其中--with-binutils = dir 选项用来指定binutils编译库的安装目录,遂在配置中加上
./configure --with-kernel-support --target=arm-9tdmi-linux-gnu --host=arm-9tdmi-linux-gnu --build=i686-pc-linux-gnu --with-binutils=/work/binutils/binutils-2.17-install-dir/ --prefix=/work/OProfile/myOProfile
执行ok,产生Makefile文件
然后执行make
给出几个常量没有定义,如:PATH_MAX等。找到相应的头文件,解决之。make编译通过,
Make install 安装binutils到/work/OProfile/myOProfile
但是个人认为应该还有其他的解决方法。
缺少的库在交叉编译后,直接拷贝到编译器下的lib目录不是很好的方法,
选项中
--libdir=DIR
object code libraries [EPREFIX/lib]
--includedir=DIR
C header files [PREFIX/include]
应该可以用来引导编译器找到外部的库文件和头文件所在的目录吧。
error ===> ./configure --with-kernel-support --target=arm-9tdmi-linux-gnu --host=arm-9tdmi-linux-gnu --build=i686-pc-linux-gnu --prefix=/work/OProfile/myOProfile --libdir=/work/popt/poptinstall/lib --includedir=/work/popt/poptinstall/include
行不通,必须把popt库手动拷贝到交叉编译器的lib目录下。
接下来的工作就是在JK2410开发板上配置OPfile了。