[Toybox] What am I doing wrong with ndk-r20?

enh enh at google.com
Thu Oct 10 15:20:42 PDT 2019


On Thu, Oct 10, 2019 at 2:31 PM Rob Landley <rob at landley.net> wrote:
>
> On 10/9/19 9:47 PM, enh wrote:
> > On Wed, Oct 9, 2019, 19:10 Rob Landley <rob at landley.net
> > >     How about:
> > >
> > >     #if defined(__BIONIC__) && !defined(__ANDROID_NDK__) && !defined(__NDK_MAJOR__)
> >
> > Yeah, that should work for everything.
>
> It doesn't seem to, though. Possibly because __NDK_MAJOR__ is #defined in
> ndk-version.h which the headers only #include from two places:
>
> $ grep -r ndk-version
> sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h:#include
> <android/ndk-version.h>
> toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/support/android/locale_bionic.h:#include
> <android/ndk-version.h>
>
> Neither of which is already included from portability.h, and I kinda doubt:
>
> #ifdef __BIONIC__
> #include <android/ndk-version.h>
> #if !defined...
>
> is going to work well in the AOSP build which is _not_ an NDK.
>
> Also, this bit is now awkward:
>
> // Android NDKv18 has liblog.so but not liblog.c for static builds,
> // stub it out for now.
> #ifdef __ANDROID_NDK__
> #define __android_log_write(a, b, c) (0)
> #define adjtime(x, y) (0)
> #endif
>
> Is that still needed, or...?

that comment is misleading --- there is no liblog.a. (you could use
syslog(3), but every time i think about rewriting log(1) to use
syslog(3) i hit the fact that there are some Android log levels not
representable by syslog(3). i wish i'd never added log(1), and had
just forced folks over to POSIX logger(1) instead. i'm hampered in
that by the fact that `log` is not something you can easily grep for
to find out who'd be affected!)

there's no adjtime(3), either, and it's not likely to be added, so
that should probably go in a separate block. (or there _is_
adjtimex(2) if you want to just rewrite your call site.)

> Rob


More information about the Toybox mailing list