Hi,

The Android Open Source Project (AOSP) includes a copy of the Linux 
kernel's "Perf" tool, but it is quite old.  Furthermore, as of 3.10, the 
Linux kernel includes ./tools/perf/Documentation/android.txt, which 
purports to explain how to cross-build Perf for Android (ARM or x86).

https://android.googlesource.com/kernel/common/+/android-3.10/tools/perf/Documentation/android.txt

However, when following those directions, I get an error about an unfound 
"bitsperlong.h" file, and I have not been able to suss out the reason.

My steps:

1. Download AOSP
2. Download linux 3.10.17, extract to $HOME/work/aosp/kernel
3. Build AOSP (which won't actually build the above kernel, but this is 
expected)
4. Generate or supply appropriate .config for kernel, and cross-build 
kernel with:
make ARCH=arm 
CROSS_COMPILE=/home/rbissell/work/aosp/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-

5. Follow the instructions "./kernel/tools/perf/Documentation/android.txt", 
for cross-building Perf for ARM, using a sysroot derived from the AOSP 
source tree:

$ cd ~/work/aosp
$ source build/envsetup.sh
$ lunch
$ cd ${ANDROID_BUILD_TOP}/ndk
$ ./build/tools/build-ndk-sysroot.sh --abi=arm
$ export 
NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-arm
$ export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/arm-linux-androideabi-
$ cd ${ANDROID_BUILD_TOP}/kernel/tools/perf
$ make ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} 
CFLAGS="--sysroot=${NDK_SYSROOT}"

The final step above fails with the error message below.   (However, if I 
just build Perf for the host system (x86_64), it builds fine.)

In file included from 
/home/rbissell/work/aosp/kernel/arch/arm/include/uapi/asm/posix_types.h:35:0,
                 from 
/home/rbissell/work/aosp/kernel/include/uapi/linux/posix_types.h:35,
                 from 
/home/rbissell/work/aosp/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed/sys/types.h:46,
                 from 
/home/rbissell/work/aosp/ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h:33,
                 from util/util.h:44,
                 from builtin.h:4,
                 from perf.c:9:
/home/rbissell/work/aosp/kernel/include/uapi/asm-generic/posix_types.h:4:29: 
fatal error: asm/bitsperlong.h: No such file or directory

I am uncertain what is wrong.  There is a "bitsperlong.h" in the kernel 
tree, but it exists in asm-generic/, not asm/.  Elsewhere on the internet, 
people suggest copying the file or creating a symbolic link.  Not only does 
that not feel like a correct solution to this problem-- native build 
doesn't require doing that-- it actually doesn't work (just leads to 
further compilation errors.)

I think I must be overlooking something?

</ryan>

-- 
-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to