[Toybox] toys/android/log.c with android NDK?

enh enh at google.com
Wed Feb 14 16:30:05 PST 2018


On Wed, Feb 14, 2018 at 3:36 PM, Rob Landley <rob at landley.net> wrote:
> I grabbed the current ndk (-r16b), make_standalone_toolchain.py'd an --arch
> x86_64 --api 26 toolchain, and then built defconfig toybox with it, and at link
> time it failed to find:
>
>  '__android_log_write'
>  'facilitynames'
>  'getgrgid_r'
>  'iconv'
>  'iconv_open'
>  'prioritynames'
>  'sethostname'
>  'stderr'
>  'stdin'
>  'stdout'
>
> I've mentioned stdin/stdout/stderr here before. sethostname() is a trivial
> syscall wrapper, iconv() and iconv_open() I _know_ bionic has because I
> complained about them being implemented in c++, android_log_write() is your own
> function (and the double underscore is confusing)...
>
> More to the point all of this _compiled_, meaning it's in the headers. And then
> it couldn't find it in the libraries. So there's a consistency issue somewhere.

i suspect you said "--api 26" but then also tried to build a static
binary? in which case you linked against an api 21 libc.a. as i said
(somewhere) earlier today, NDK r17 (and later) will have a modern
libc.a, but for NDK r16 you'll want to either (a) set --api 21 for
static binaries or (b) build a dynamic binary for --api 26.

longer term (https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md)
we want to make standalone toolchains obsolete by just teaching the
clang driver everything it needs to know about Android, so hopefully
before the end of the year it's just a matter of `CC=ndk-clang make
defconfig`.

> I can try to fix it up in lib/portability.c...?

the __android_log_write thing might need a fix on your side: i suspect
you're missing a -l for the NDK liblog?

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list