源码编译Oprofile
上菜了翠花:
首先编译Oprofile需要三个源码:binutils、popt与oprofile
Linux版(由于是在64位的linux系统编译-----敬请参考“在64位linux上编译32位程序”)
binutils
#!/bin/sh
cd binutils-2.21
./configure CFLAGS=-m32 CXXFLAGS=-m32 FFLAGS=-m32 FCFLAGS=-m32 LDFLAGS="-L/usr/lib32" --with-kernel-support --prefix=/home/henry/workspace/opf/pc/build/binutils --enable-shared
make LDFLAGS="-all-static"
make&&make install
cd .
popt
#!/bin/sh
cd popt-1.14/
ac_cv_va_copy=yes ./configure CFLAGS=-m32 CXXFLAGS=-m32 FFLAGS=-m32 FCFLAGS=-m32 LDFLAGS="-L/usr/lib32" --with-kernel-support --enable-static --prefix=/home/henry/workspace/opf/pc/build/popt
make&&make install
cd ..
oprofile
#!/bin/sh
cd oprofile-0.9.6/
./configure CFLAGS=-m32 CXXFLAGS=-m32 FFLAGS=-m32 FCFLAGS=-m32 LDFLAGS="-L/usr/lib32" --enable-static --with-kernel-support --prefix=/home/henry/workspace/opf/pc/build/oprofile/ --with-extra-libs=/home/henry/workspace/opf/pc/build/popt/lib/ --with-extra-includes=/home/henry/workspace/opf/pc/build/popt/include/ --with-binutils=/home/henry/workspace/opf/pc/build/binutils
make LDFLAGS="-all-static -L/home/henry/workspace/opf/build/binutils/lib -L/home/henry/workspace/opf/build/popt/lib/ -L/usr/lib32"
make install
cd ..
拷贝libiberty.h 与libiberty.lib到binutils相应的目录
后续将提android arm版,敬请关注,请点个赞,谢谢!