It would be good to include the NDK version (as releases really change what works and doesn't.)
I think you have at least a disconnect between:
--target=armv7-none-linux-androideabi21
-march=armv7-a
armv7a and armv7 are different (incompatible) targets. I suspect you want v7a everywhere, and
I agree that it's annoying that the clang/gcc/ndk options/paths for includes/libraries aren't exactly
the same. (You may also be setting yourself up for more fun later on combining the gcc LDPATH
option and using clang....)
Look into the standalone tool chain:
It eats a bunch of disk space, but copies all the parts for an arch to a particular place.
This eliminates typos/guesses in the CFLAGS/LDFLAGS sections.
As an alternative, if you are building things that use CMake, the latest NDKs have ok support.
and you can just add
-DTARGET_ARCH=ANDROID \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_PLATFORM=android-21 \
-DANDROID_STL=c++_shared \
-DCMAKE_TOOLCHAIN_FILE=${NDK_ROOT}/build/cmake/android.toolchain.cmake \
to your cmake command and it should pick all the right arch/target/include combos for you.
I haven't done iconv, but you can see the aws-cpp-sdk do openSSL/curl for older NDKs.
(They go the "build standalone tool chain" route but currently their NDK version detection
code is busted.)
Dan S.