ndk-build error after Intel® C++ Compiler integration with Android* NDK r16

By Yang Wang, Published: 11/29/2017, Last Updated: 11/28/2017

Issue description

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-icc18.0.1.156"   .  Stop.

Affected product

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)")
#    endif

              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



      Building a native Android* app with Intel® C++ Compiler in Android Studio*



Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804