How to cross compile strace for android on Ubuntu

I have been working on cross compiling many applications for the android platform.
Strace was the first one I compiled this time.
Below are the instructions for how to cross compile.
Taken from many webpages and made into this guide.

taken from:http://forum.xda-developers.com/showthread.php?t=2516002&page=3

Install android cross compiler: sudo apt-get install gcc-arm-linux-gnueabi

– Download strace source package: http://sourceforge.net/projects/stra…atest/download
– Extract and go into the sources directory, ie: tar xf strace-4.8.tar.xz; cd strace-4.8
– Apply the following patch with something like: “patch -p1 < /tmp/strace-arm.patch —————- diff -upr strace-4.8/signal.c strace-4.8-arm/signal.c — strace-4.8/signal.c 2013-05-23 06:41:23.000000000 -0700 +++ strace-4.8-arm/signal.c 2014-04-06 19:00:27.000000000 -0700 @@ -60,6 +60,10 @@ # include
#endif

+#if defined(ARM)
+#include
+#endif
+
#if defined(SPARC) || defined(SPARC64) || defined(MIPS)
typedef struct {
struct pt_regs si_regs;
diff -upr strace-4.8/syscall.c strace-4.8-arm/syscall.c
— strace-4.8/syscall.c 2013-05-14 07:10:42.000000000 -0700
+++ strace-4.8-arm/syscall.c 2014-04-06 19:00:53.000000000 -0700
@@ -80,6 +80,10 @@
# include
#endif

+#if defined(ARM)
+#include
+#endif
+
#ifndef ERESTARTSYS
# define ERESTARTSYS 512
#endif
—————–
export CC=/usr/bin/arm-linux-gnueabi-gcc
export STRIP=arm-linux-gnueabi-strip
export CFLAGS=”-march=armv7-a -O2 -static”
./configure –host=arm-linux
make
$STRIP strace
unset CC STRIP CFLAGS

Leave a Reply