The README files in the source tarballs available on http://lttng.org/download seem to assume that one is building on the same Linux system that will be the target for traces. I've found other resources that explain how to do this (the LTTng Project YouTube channel has very nice screencasts), but I can't find any instructions for how to cross-compile LTTng (specifically, I guess, liburcu, LTTng-UST, LTTng-tools, and LTTng-modules), and install it all on a embedded Linux system (where I can build or rebuild the kernel, use a device tree blob and—for now—a ramdisk-based file system).
Where can I find details on how to do this?
Update: As Marko points out in the first comment below, the LTTng tools are built using autoconf
. I understand in theory that I can figure out a "--host" option to configure
, similar to this answer. And perhaps I need a parameter like "ARCH=arm" to make
like I use when building the kernel. But what is the cross-compilation equivalent of make install
that is used when building the LTTng components on the same machine where they'll be used?
LTTng 2.x no longer requires a patched kernel. You need to load a kernel module (lttng-modules) in order to do kernel tracing. The lowest Linux kernel version supported is 2.6.38. You can go as low as 2.6.32 but you will need to apply 3 patches to your kernel according to LTTng 2.1 release note and lttng-modules README.
To respond to your cross-compilation question, here is the usual procedure I use to cross-compile the LTTng toolchain (for user space tracing):
export HOST=<your host triplet (e.g. arm-linux-gnueabi)>
# Make sure your cross-compiler can be found in your $PATH
export SYSROOT=<path to the target sysroot>
export CFLAGS="--sysroot=$SYSROOT"
export CPPFLAGS="-I$SYSROOT/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="--sysroot=$SYSROOT -L$SYSROOT/usr/lib -L$SYSROOT/lib"
# Fix RPL_MALLOC issue. See [Autoconf and RPL_MALLOC][3] for more details.
export ac_cv_func_malloc_0_nonnull=yes
# Cross compile userspace-rcu. You can also use a source tarball.
git clone git://git.lttng.org/userspace-rcu.git
cd userspace-rcu
./bootstrap
./configure --prefix=$SYSROOT --host=$HOST --with-sysroot=$SYSROOT
make
make install
# Cross compile lttng-ust. You can also use a source tarball.
git clone git://git.lttng.org/lttng-ust.git
cd lttng-ust
./bootstrap
./configure --prefix=$SYSROOT --host=$HOST --with-sysroot=$SYSROOT
make
make install
# Cross compile lttng-tools. You can also use a source tarball.
git clone git://git.lttng.org/lttng-tools.git
cd lttng-tools
./bootstrap
./configure --prefix=$SYSROOT --host=$HOST --with-sysroot=$SYSROOT
make
make install
You should be able to adapt this to your platform. If you want to do kernel tracing, you will also need to cross-compile lttng-modules in a similar fashion.