[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Build broken with the latest preview of Android NDK a
From: |
Chi-Hsuan Yen |
Subject: |
Re: [Bug-readline] Build broken with the latest preview of Android NDK and clang (r15 beta 2) |
Date: |
Fri, 9 Jun 2017 15:23:46 +0800 |
On Thu, Jun 8, 2017 at 4:01 AM, Chet Ramey <address@hidden> wrote:
> On 6/6/17 10:13 AM, Chi-Hsuan Yen wrote:
>> Hello readline experts,
>>
>> I maintain a set of packages on Android. A recent change in Android's
>> NDK (Native Development Kit) breaks building readline. Here are steps
>> to reproduce:
>>
>> (Download
>> https://dl.google.com/android/repository/android-ndk-r15-beta2-linux-x86_64.zip
>> and extract to ~/tmp/)
>> $ export ANDROID_NDK="$HOME/tmp/android-ndk-r15-beta2"
>> $ "$ANDROID_NDK/build/tools/make_standalone_toolchain.py"
>> --install-dir toolchain --api 21 --arch arm64 --unified-headers
>> (git clone readline.git and cd into it)
>> $ export PATH="$(pwd)/toolchain/bin:$PATH"
>> $ CC="$(pwd)/toolchain/bin/aarch64-linux-android-clang"
>> CROSS_COMPILE=aarch64-linux-android- ./configure
>> --host=aarch64-linux-android
>> $ make
>>
>> It fails with:
>>
>> /home/yen/Projects/tmp/readline/toolchain/bin/aarch64-linux-android-clang
>> -c -DHAVE_CONFIG_H -I. -I. -DRL_LIBRARY_VERSION='"7.0"' -g -O
>> search.c
>> In file included from search.c:46:
>> ./histlib.h:55:14: error: redeclaration of 'strchr' must have the
>> 'overloadable' attribute
>> extern char *strchr ();
>> ^
>> /home/yen/Projects/tmp/readline/toolchain/bin/../sysroot/usr/include/string.h:69:7:
>> note: previous overload of function is here
>> char* strchr(const char* _Nonnull, int) __attribute_pure__ __overloadable
>> ^
>> 1 error generated.
>> make: *** [search.o] Error 1
>>
>> As a workaround, I just remove the "#ifndef strchr" block from histlib.h.
>
> Thanks for the report. Your fix is ok for a temporary workaround; a more
> complete fix might look something like
>
> #ifndef member
> # if !defined (strchr) && !defined (__STDC__)
> extern char *strchr ();
> # endif /* !strchr && !__STDC__ */
> #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
> #endif
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
Thanks! The __STDC__ patch also works fine! (NDK r15 stable is
released yesterday, so I tested against it)