There is an issue discovered with integration of Intel® C++ compiler toolchains into Android NDK r16. After integration of Intel® System Studio 2018 with Android NDK r16, if NDK_TOOLCHAIN is not set explicitly in the Applications.mk or from ndk-build option, you would see the error “Expected two items in TARGET_TOOLCHAIN_LIST ” for all invocations of ndk-build. For example, following message may be reported:
…/android-ndk-r16/build//../build/core/setup-toolchain.mk:34: *** Android NDK: Expected two items in TARGET_TOOLCHAIN_LIST found "x86_64-4.9 x86_64-clang x86_64-icc x86_64-icc184.108.40.206" . Stop.
Intel® System Studio 2018/Intel® C++ Compiler 18.0
The workaround is to comment/remove the condition below in <NDK>/build/core/setup-toolchain.mk file, around line 34 as reported from error messages. You can add “#” as following to workaround the issue.
# ifneq ($(words $(TARGET_TOOLCHAIN_LIST)),2)
# $(call __ndk_error,Expected two items in TARGET_TOOLCHAIN_LIST, \
# found "$(TARGET_TOOLCHAIN_LIST)")
Alternatively you can specify the NDK_TOOLCHAIN explicitly for your native build. This can be done in your Application.mk file, or specify it from ndk_build command line, or in the build.gradle file from Android Studio. For example, use “x86_64-icc” for build with Intel C++ Compiler for 64bit Android target, add the following line in Application.mk file:
NDK_TOOLCHAIN := x86_64-icc