[Toybox] [PATCH] libcutils isn't in the NDK.

enh enh at google.com
Wed Oct 17 14:51:16 PDT 2018


On Wed, Oct 17, 2018 at 2:05 PM Rob Landley <rob at landley.net> wrote:
>
> On 10/10/2018 11:43 AM, enh wrote:
> >> Then it works with glibc and musl, but _not_ with the android NDKr18:
> >
> > yeah, hard to know what to do with something non-standard like that,
> > but if we're in a world where some have one and others have the other,
> > we usually end up having both.
>
> Indeed.
>
> It would be nice if there was a proper reference spec with test suite. I'm
> trying to establish a "minimal base system", but I can only swap out _some_ of
> the components (currently not including the kernel, and thus the kernel headers
> in the toolchains).
>
> > conveniently musl and glibc make _SC_UIO_MAXIOV the same as the
> > existing _SC_IOV_MAX so i'll do the same and it'll even be backwards
> > compatible for old OS releases.
> >
> > added by https://android-review.googlesource.com/c/platform/bionic/+/783682
> > and will be in r19.
>
> Cool.
>
> I was trying to cut the long-delayed release this past weekend (and now plan to
> do it this _coming_ weekend), and r18's all I've got, so I'll probably just
> #ifdef the symbol musl's missing with a TODO to remove it when r19 comes out.

yeah, r19 should out in be december.

looks like you already did this, minus the NDK comment, in
https://github.com/landley/toybox/commit/ace221343e8c8cacfc853006edfe227a85f555b3
? i was going to send you a patch adding the TODO, but if you're
already on it i'll leave it.

btw, https://github.com/landley/toybox/commit/b123b11608260218df29acdff8016908e7d213f2
seems to have misunderstood what i was saying about "stub". what i
meant is that the NDK contains .so files with symbols but no code just
so the static linker can check that your code will link at run-time.
but at run-time you'll get the *real* liblog.so from whatever version
of the OS you're running on. so __android_log_write does work for
dynamic builds. (i'm not sure what the right fix is here though,
because you really want to say `#if __static__`, except that's not a
thing.)

i think what you have is broken even for static builds, since you have
an ODR violation from the missing `static inline` on your no-op
function:

ld.lld: error: duplicate symbol: __android_log_write
>>> defined at portability.h:282 (external/toybox/lib/portability.h:282)
>>>            out/soong/.intermediates/external/toybox/toybox_vendor/android_arm64_armv8-a_cortex-a73_vendor/obj/external/toybox/lib/args.o:(__android_log_write)
>>> defined at portability.h:282 (external/toybox/lib/portability.h:282)
>>>            out/soong/.intermediates/external/toybox/toybox_vendor/android_arm64_armv8-a_cortex-a73_vendor/obj/external/toybox/toys/android/setprop.o:(.text.__android_log_write+0x0)

why am _i_ seeing this building for the platform? because we screwed
up and __ANDROID_NDK__ was actually getting defined there. thanks for
finding that :-)

> Rob


More information about the Toybox mailing list