On Sat, Mar 10, 2018 at 8:26 PM, Rob Landley <r...@landley.net> wrote: > On 03/09/2018 03:54 PM, enh wrote: >> well, that took a lot longer than expected... but r17beta1 is out now >> with an up-to-date libc.a. >> >> download: https://github.com/android-ndk/ndk/wiki#current-beta-release >> release notes: https://github.com/android-ndk/ndk/wiki/Changelog-r17-beta1 >> >> standalone toolchain example: >> https://developer.android.com/ndk/guides/standalone_toolchain.html#building_open_source_projects_using_standalone_toolchains >> >> (https://developer.android.com/ndk/downloads/index.html should update >> later this afternoon.) > > Let's see... > > $ sudo build/tools/make_standalone_toolchain.py --arch x86_64 --api 26 \ > --stl=libc++ --install-dir=/opt/android/x86-64 > $ CROSS_COMPILE=/opt/android/x86-64/bin/llvm- CFLAGS=--static make defconfig > It has no llvm-cc... ok then: > $ sudo ln -s clang /opt/android/x86-64/bin/llvm-cc > $ CROSS_COMPILE=/opt/android/x86-64/bin/llvm- CFLAGS=--static make defconfig > $ CROSS_COMPILE=/opt/android/x86-64/bin/llvm- CFLAGS=--static make > many warnings ignored... > generated/obj/log.o:log.c:function log_main: error: undefined reference to > '__android_log_write' > $ CROSS_COMPILE=... make menuconfig # switch off log in android menu.
(or add -llog.) > $ CROSS_COMPILE=... make > more warnings, more warnings... > scripts/make.sh: line 28: /opt/android/x86-64/bin/llvm-strip: No such file or > directory > strip failed, using unstripped > $ ./toybox > Illegal instruction (core dumped) > landley@driftwood:~/toybox/clean$ file toybox > toybox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically > linked, > not stripped > > Well... it's certainly progress. :) > > I'll see if I can work out why it doesn't run... > > $ /opt/android/x86-64/bin/llvm-cc --static hello.c > $ ./a.out > Illegal instruction (core dumped) > > Because a statically linked hello world segfaults on ubuntu 14.04, would be > why. > > The warnings, by the way, are primarily: > > toys/posix/iconv.c:53:5: warning: implicit declaration of function 'iconv' is > invalid in C99 [-Wimplicit-function-declaration] > iconv(TT.ic, &in, &inlen, &out, &outlen); > ^ > toys/posix/iconv.c:70:31: warning: implicit declaration of function > 'iconv_open' > is invalid in C99 [-Wimplicit-function-declaration] > if ((iconv_t)-1 == (TT.ic = iconv_open(TT.to, TT.from))) > ^ > toys/posix/iconv.c:73:24: warning: implicit declaration of function > 'iconv_close' is invalid in C99 [-Wimplicit-function-declaration] > if (CFG_TOYBOX_FREE) iconv_close(TT.ic); > > And that file is doing #include <iconv.h> so I don't see _why_ it's not > getting > them? because <iconv.h> isn't there until API 28, but a side-effect of the single sysroot for all API levels is that the *file* is there, but the contents are #ifdef'ed out since you asked for API level 26. we'll be able to provide better errors (along the lines of "iconv_open is only available in API level 28 and later") when we remove GCC later this year and only have to support clang, but r17 still includes GCC so it's just #ifdef'ed out. > Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net