[lttng-dev] compiling LTTng for android

Amit Balboul amit.balboul at shinesec.com
Thu Feb 21 05:13:29 EST 2013


Hi all,

In continue to posts from
http://www.mail-archive.com/lttng-dev@lists.lttng.org/msg02542.html,

I'm trying to build the LTTng kernel-tracer for Android on ARM:
(JB4.2.1 - kernel 3.0.31 - on Galaxy Nexus).
I'm having some trouble completing the process, didn't find any usable
information so far, maybe u can help.

I want to build the: (I've managed in the past to build the modules for
goldfish's 2.6.29 but this required patching the kernel).
(1) userspace-rcu
(2) modules
(3) tools
I'm currently stuck in the first phase (building userspace-rcu).

My steps and the issues I've encountered are:
1. Clone the userspace-rcu git repository
2. Generate a sysroot for arm-linux-androideabi from google's NDK (using
its "make-standalone-toolchain.sh" script with arm-linux-androideabi-4.4.3
toolchain).
3. Run ./bootstrap - creating config.h.in, Makefile.in, configure, ...
4. Run ./configure with --host=arm-linux-androideabi and the relevant
environment variables (CC, LD, CPPFLAGS, CFLAGS, LDFLAGS, LIB), pointing to
the NDK ARM SYSROOT.
5. Run make

Some errors I encoutered and their fixes (workarounds), while trying as
much as I can leave the sources untouched:
1. syscall.h not found. In some files, the <syscall.h> is included. In NDK
SYSROOT the syscall.h lays in sys/
FIX: created a link: SYSROOT/include/syscall.h ->
SYSROOT/include/sys/syscall.h
2. Android's libraries includes the pthread lib automatically, thus not
having a stand-alone pthread library.
FIX: removed "-lpthread" from Makefile.am, tests/Makefile.am
3. static declaration of "gettid" follows non-static declaration (in
SYSROOT/include/unistd.h, "gettid" is declared as "external")
For the mean time I commented this declaration... Maybe adding "#ifndef
gettid" before the declaration of  "static gettid" in the sources will fix
it ?
4. rand_r not declared - added a module that implements rand_r (as seen in
https://github.com/xbmc/xbmc/tree/master/xbmc/android/bionic_supplement)
5. undefined reference to rpl_malloc
FIX: setting ac_cv_func_malloc_0_nonnull=yes before launching ./configure.

now, after running ./configure and make, still not completed. I get many
"undefined reference to __sync_syncronize" messages. the
urcu/arch/generic.h defines the memory barriers functions as cmm_* but
their implementation is not taken from urcu/arch/arm.h but from Line 46 in
the same file (generic.h).
Can u help with this?
Am I missing something here ?

Also, how does the build system use the kernel 3.0.31 (or any other)
sysroot ?

Thank you

Amit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130221/30c220c0/attachment.html>


More information about the lttng-dev mailing list