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

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*



Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.