posts - 79, comments - 76, trackbacks - 0, articles - 1
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理


Compilation problem with oprofile regarding libbfd on latest android-4.2.2_r1 branch?

Posted on 2013-04-03 22:19 sinojelly 阅读(...) 评论(...) 编辑 收藏

Hi all,

I am trying to compile the latest android-4.2.2_r1 branch from source (ARM arch, full-eng configuration) and I bump into the following compilation error along the road:

Import includes file: out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/import_includes
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
Export includes file: frameworks/base/tools/obbtool/ -- out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/export_includes
host Executable: obbtool (out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/obbtool)
Install: out/host/linux-x86/bin/obbtool
Export includes file: external/oprofile/libpp/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/export_includes
Export includes file: external/oprofile/libdb/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_db_intermediates/export_includes
Export includes file: external/oprofile/libregex/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_op_regex_intermediates/export_includes
Export includes file: external/oprofile/libopt++/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_opt++_intermediates/export_includes
Export includes file: external/oprofile/libutil++/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_util++_intermediates/export_includes
Export includes file: external/oprofile/libpopt/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_popt_intermediates/export_includes
Export includes file: external/oprofile/libop/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_op_intermediates/export_includes
Export includes file: external/oprofile/libutil/ -- out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_util_intermediates/export_includes
make: *** No rule to make target `out/host/linux-x86/obj/STATIC_LIBRARIES/libbfd_intermediates/export_includes', needed by `out/host/linux-x86/obj/EXECUTABLES/opannotate_intermediates/import_includes'.  Stop.

I search for some solutions and noticed that a possible solution is to edit external/oprofile/

# Common host flags
HAVE_LIBBFD := false

ifeq ($(TARGET_ARCH),arm)
toolchain := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-4.6
common_host_c_includes := $(common_c_includes) $(toolchain)/include
common_host_cflags := $(common_cflags) -fexceptions -DANDROID_HOST -DHAVE_XCALLOC
common_host_ldlibs_libiconv :=

ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-x86)
common_host_cflags += -DMISSING_MREMAP
common_host_ldlibs_libiconv := -liconv
ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
HAVE_LIBBFD := false

Quote from a post I found regarding this topic: "Yes, if you're using linaro's toolchain you need to set HAVE_LIBBFD := false in external/oprofile/". I noticed this is apparently not an android-4.2.2_r1 specific problem, but older version have this too. 

 is apparently a Binary File Descriptor library and it seems my tool chain has this functionality too:

$ ls -1 <toolchainpath>/arm-linux-androideabi-4.6/lib32

I have 2 question about this:

  1. Someone has any idea why the library is not picked up correctly, although it seems to be included in the tool chain?
  2. Is it OK to just disable the BFD support in oprofile (a continuous system-wide profiler)? It sounds like this might have mayor impact on my resulting build.

Any hints on this one really appreciated.


Best regards,



Are you using the Android-provided toolchains in prebuilts/gcc/? Did you make any change to it?
The Android platform build system will pick up the prebuilt libbfd (and other libraries) via the following makefiles:
Then that file will be conditionally included in build/libs/host/