aarch64-linux compile problem
enh
enh at google.com
Sat Jan 28 03:36:21 UTC 2017
On Fri, Jan 27, 2017 at 7:16 PM, enh <enh at google.com> wrote:
> sadly building stuff with the NDK can be fun at the best of times, and
> strace is actually a pretty hairy project to build. we're working on
> improving the NDK (see below) and i'll try to make sure we add some
> documentation for what the traditional "configure && make" looks like
> with the NDK.
>
> anyway, here's how to build a 32-bit ARM strace 4.15 binary with the NDK:
>
> * download NDK r14 beta 1 from https://github.com/android-ndk/ndk/wiki
>
> * unpack it
>
> * generate a standalone
> toolchain[https://developer.android.com/ndk/guides/standalone_toolchain.html]
> using unified headers[https://android.googlesource.com/platform/ndk/+/master/docs/UnifiedHeaders.md]:
>
> ./android-ndk-r14-beta1/build/tools/make_standalone_toolchain.py
> --unified-headers --arch arm --api 24 --install-dir /tmp/ndk-arm
>
> * download strace 4.15
>
> * unpack it
>
> * hack a couple of things:
>
> 1. strace seems to need mtd/mtd-abi.h and mtd/ubi-user.h for mtd.c.
> they're not in r14beta1 so you'll need to copy them from
> bionic[https://android.googlesource.com/platform/bionic/+/master/libc/kernel/uapi/mtd/]
> into /tmp/ndk-arm/sysroot/usr/include/mtd/ (which you'll have to
> create).
>
> this is already fixed in r14 beta 2, but that's held up in QA. sorry.
(the NDK maintainer points out that we do however make canary builds
available[https://android.googlesource.com/platform/ndk/+/master/docs/ContinuousBuilds.md]
--- note that the downloads default to darwin, so you'll want to
change that combo box too if you're following the instructions but use
linux.)
> 2. strace assumes the glibc name __key for the struct ipc64_perm
> field. add these lines to sys/ipc.h in /tmp/ndk-arm:
>
> +#if defined(__USE_GNU)
> +#define __key key
> +#define __seq seq
> +#endif
>
> i'll add that to
> bionic[https://android-review.googlesource.com/#/c/329669/] and it'll
> be in a future NDK release.
>
> * setup:
>
> export CC=/tmp/ndk-arm/bin/arm-linux-androideabi-clang
> export CFLAGS="-fPIE -fPIC -pie"
> ./configure --host=arm-linux-androideabi
> make
>
> * push the resulting "strace" to your device and use it.
>
> $ adb push strace /data/local/tmp/strace
> $ adb shell /data/local/tmp/strace -V
> strace -- version 4.15
> $
>
> (i actually traced a real executable, but the output of -V was less
> spammy for the purposes of this email.)
>
> On Thu, Jan 26, 2017 at 7:31 AM, Larry Dickson <tjoccam at tjoccam.com> wrote:
>> Hello strace developers,
>>
>> After discovering that the Samsung S2 T710 Android tablet is really 32 bit,
>> we attempted to cross-compile strace using the NDK in 32 bits. Again I went
>> for android-ndk-r13b-linux-x86_64.zip, which is in
>>
>>
>> https://developer.android.com/ndk/downloads/index.html
>>
>> and brought it up according to
>>
>> http://nickdesaulniers.github.io/blog/2016/07/01/android-cli/
>>
>> (except for the source fetch, which was just a download). OK.
>>
>>
>> Instead of aarch64-linux-android-gcc I used arm-linux-androideabi-gcc, and
>> similar for strip; instead of --host=aarch64-linux I used --host=arm-linux.
>> ./configure worked but not make, which failed quickly on
>>
>> print_msgbuf.c:35:21: fatal error: sys/msg.h: No such file or directory
>>
>> Are there any known paths to successful compilation of strace for the
>> Android?
>>
>> Larry Dickson
>> Space Sciences Corporation
>>
>> On Jan 24, 2017, at 8:15 AM, Larry Dickson <tjoccam at tjoccam.com> wrote:
>>
>> Hello strace developers,
>>
>> We need strace on our Samsung S2 T710 Android tablet, and I tried to
>> cross-compile it on our Dell XPS-13 (Ubuntu 14.04 LTS) laptop. I went for
>> android-ndk-r13b-linux-x86_64.zip, which is in
>>
>> https://developer.android.com/ndk/downloads/index.html
>>
>> and brought it up according to
>>
>> http://nickdesaulniers.github.io/blog/2016/07/01/android-cli/
>>
>> (except for the source fetch, which was just a download). OK. Then I
>> downloaded strace-4.15.tar.xz from sourceforge and followed Muzso
>>
>> http://muzso.hu/2012/04/21/how-to-compile-strace-for-use-on-an-android-phone-running-an-arm-cpu
>>
>> except that I fixed the names and substituted aarch64-linux for arm-linux in
>> the ./configure, which worked. (I used aarch64-linux instead of arm-linux
>> because our device CPU is an Exynos 5433, which is an ARMx8-A.)
>>
>> The make failed with error
>>
>> # error struct flock64 definition not found in <linux/fcntl.h>
>>
>> which is an error discussed nowhere on the web, though I can find struct . .
>> . fcntl.h> in three source files.
>>
>> Thank you for any help you can give!
>>
>> Larry Dickson
>> Space Sciences Corporation
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Strace-devel mailing list
>> Strace-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/strace-devel
>>
>
>
>
> --
> Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> Android native code/tools questions? Mail me/drop by/add me as a reviewer.
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Strace-devel
mailing list