Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Known Issue: NDK_TOOLCHAIN does not work in Application.mk for other compilers after integration of the Intel® C++ Compiler 15.0 toolchain

$
0
0

Product affected: Intel® System Studio 2015

Component affected:Intel® C++ Compiler 15.0 for Android* target 

OS affected: Windows OS, Linux OS

NDK affected: should affect all supported NDK versions (verified with NDK r9d to reproduce).

Internal defect tracking ID (CQ): DPD200362855

Issue

After integration the Intel® C++ Compiler as additional toolchain to the Android* NDK versions (example: r9d), it will fail to use NDK_TOOLCHAIN in Application.mk to switch the compiler to other compilers (Note: When Intel(R) C++ compiler is integrated to NDK, it will become default compiler for x86 target, if you want to compare the performance gain of Intel Compiler, you may want to switch the compiler back to GCC* or Clang* for testing purpose.)

Steps to reproduce

1. Integrate Intel C++ compiler to NDK (during installation or manual integration), for example: android-ndk-r9d-windows-x86_64.zip (suppose, it was installed into <NDK_DIR>)

2. Build "hello-jni" with Intel C++ compiler

Open command prompt and go to "<NDK_DIR>\samples\hello-jni" directory, check the "jni\Application.mk" file (if it does not exist, you may create one), and make sure it has below line:

APP_ABI := x86

Then, build with: ..\..\ndk-build, it will be built successfully and using Intel C++ Compiler for Android*.

You can also use "..\..\ndk-build NDK_TOOLCHAIN=x86-icc" to specify to use Intel C++ Compiler explicitly.

3. Build "hello-jni" with GNU GCC* (or other supported compilers)

In the same command prompt, build with "..\..\ndk-build NDK_TOOLCHAIN=x86-4.8"

4. Using NDK_TOOLCHAIN in Application.mk

Put NDK_TOOLCHAIN=x86-4.8 in jni/Application.mk file. And build with "..\..\ndk-build", you will get below error:

Android NDK: The selected toolchain (x86-4.8) does not support the x86 ABI.
Android NDK: Please modify the APP_ABI definition in ./jni/Application.mk to use
Android NDK: a set of the following values: x86
Android NDK: Or change your NDK_TOOLCHAIN definition.
....../android-ndk-r9d-windows-x86_64/android-ndk-r9d/build/core/setup-toolchain.mk:86: *** Android NDK:

 

Workaround:

First workaround is to use NDK_TOOLCHAIN in command line, but if you are using Eclipse and you hope to use it in Application.mk. You can change ICC's config.mk to fix it:

Go to "<NDK_DIR>\toolchains" directory, which list the tool-chains you can use (these folder names are the available values for NDK_TOOLCHAIN), go to "x86-icc" folder, and open the file "config.mk", you can find below lines at the end of the file, delete them or comment them out as below:

#ifndef NDK_TOOLCHAIN
#$(eval NDK_ABI.$(TOOLCHAIN_ARCH).toolchains := $(filter $(TOOLCHAIN_ARCH)-icc%,$(NDK_ABI.$(TOOLCHAIN_ARCH).toolchains)))
#endif

Do the same thing for the config.mk file in "x86-icc15.0.0.027" folder. 

Another workaround is to use "NDK_TOOLCHAIN_VERSION=4.8" instead of "NDK_TOOLCHIAN" in Application.mk, but this may only be a workaround if you want to switch to GCC (In case you want to switch to Clang, please still fix the config.mk file as the workaround).


Viewing all articles
Browse latest Browse all 3384

Trending Articles