* Problem: Android APP fails to load ZMQ since NDK r25.x
With the help of the dump of ./configure options (former PR):
```
LIBZMQ (arm) - ./configure options to build 'LIBZMQ':
> --quiet
> TOOLCHAIN=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64
> CC=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang
> CXX=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++
> LD=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/ld
> AS=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
> AR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
> RANLIB=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
> STRIP=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
> CFLAGS= -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE
> CPPFLAGS= -I/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/include
> CXXFLAGS=
> LDFLAGS=-L/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/lib -L/tmp/android-ndk-r25/sour\
ces/cxx-stl/llvm-libc++/libs/armeabi-v7a
> LIBS=-lc -ldl -lm -llog -lc++_shared
> PKG_CONFIG_LIBDIR=/tmp/android-ndk-r25/prebuilt/linux-x86_64/lib/pkgconfig
> PKG_CONFIG_PATH=/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm/lib/pkgconfig
> PKG_CONFIG_SYSROOT_DIR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
> PKG_CONFIG_DIR=
> --with-sysroot=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
> --host=arm-linux-androideabi
> --prefix=/home/stephan/git/zproject-android-testing/libzmq/builds/android/prefix/arm
> --disable-curve
> --without-docs
```
We can observe that LDFLAGS has invalid `-L<path_to_libc++_shared.so>`:
```
-L/tmp/android-ndk-r25/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a
```
This path is no more valid, since NDK r25, where one should use LLVM path.
Ok, once this is fixed, ./configure requires also the path to libc.so.
I don't understand why libc.so is now required, actually, but without this, ./configure fails
to build its conftest.
Solution: Fix invalid LDFLAGS.
Notes:
- To be reported to CZMQ/ZYRE via ZPROJECT.
- Tested successfully with Android Emulator (x86 & x86_64).
- Still need some more work, as execution still fails with physical devices (observed on arm64).
- Introduced `ANDROID_STL`, `ANDROID_STL_ROOT` & `ANDROID_LIBC_ROOT`. All are initialized in `android_build_helper.sh`.
- New mechanism **MUST** be compatible with former NDK versions.
Proposal is to dump ./configure options to have an output like below:
```
LIBZMQ (x86_64) - ./configure options to build 'LIBZMQ':
> --quiet
> TOOLCHAIN=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64
> CC=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang
> CXX=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang++
> LD=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/ld
> AS=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
> AR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
> RANLIB=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
> STRIP=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
> CFLAGS= -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE
> CPPFLAGS= -I/builds/CrisalidBox/zproject-android-testing/libzmq/builds/android/prefix/x86_64/include
> CXXFLAGS=
> LDFLAGS=-L/builds/CrisalidBox/zproject-android-testing/libzmq/builds/android/prefix/x86_64/lib -L/tmp/android-ndk-r25/sources/cxx-stl/llvm-libc++/libs/x86_64
> LIBS=-lc -ldl -lm -llog -lc++_shared
> PKG_CONFIG_LIBDIR=/tmp/android-ndk-r25/prebuilt/linux-x86_64/lib/pkgconfig
> PKG_CONFIG_PATH=/builds/CrisalidBox/zproject-android-testing/libzmq/builds/android/prefix/x86_64/lib/pkgconfig
> PKG_CONFIG_SYSROOT_DIR=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
> PKG_CONFIG_DIR=
> --with-sysroot=/tmp/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot
> --host=x86_64-linux-android
> --prefix=/builds/CrisalidBox/zproject-android-testing/libzmq/builds/android/prefix/x86_64
> --disable-curve
> --without-docs
```
Note:
This mechanism is currently in use to identify/fix a bug in a recent PR for NDK update.
This mechanism is added before every call of `./configure`.
To be reported to CZMQ/ZYRE (via ZPROJECT).
Seen in the code:
```
function android_build_verify_so {
...
for dep_soname do
if [[ $elfoutput != *"library: [${dep_soname}]"* ]]; then
ANDROID_BUILD_FAIL+=("Library ${soname} was expected to be linked to library with soname:")
ANDROID_BUILD_FAIL+=(" ${dep_soname}")
fi
done
```
The `for xxx` syntax is wrong, most probably a typo somewhere.
Solution: Fix & complete the `for xxx` loop.
Tested with & without LIBSODIUM (only available dependent library for LIBZMQ).
Note: The same has to be done in ZPROJECT, for CZMQ & ZYRE.
Solution: Modify the build scripts so the user can specify the platform
for which to build, e.g. `./build.sh arm`. This approach originally
significantly reduces the parameters which have to be set before running
the script.
Further the build process is documented in a README now.
Solution: Migrate build scripts from Android NDK r11c to r20.
- Standalone toolchain
- Migration from GCC to Clang
- Migration from libgnustl to libc++
- Dropped support for API level below 16 (Android 4.1), previously it was API level 9 (Android 2.3)
- Dropped support for mips architecture
- The build script now start the build of all 4 Android architectures (arm, arm64, x86, x86_64)
Solution: set the appropriate options, environment variables and paths
so that the host pkg-config files are ignored, and the target ones are
used instead (if any)