Error about hello-jni

Error about hello-jni

imagem de Hide10

Hello members,

Now, I’m setting the Intel C++ Compiler for Android.
But I can’t set the configuration.

[Error Coment]
Command Prompt Error (by Build Environment for Android)
D:\android\android-ndk-r9b\samples\hello-jni\jni>icc -c hello-jni.c
icc: error #10001: could not find directory in which i686-linux-android-g++.exe resides

Please let me the workaround in order to avoid the error.
The current situation is as follows

[Development Environment]
OS: Windows 7 Home Premium (32bit)
JDK: jdk1.7.0_45
SDK: adt-bundle-windows-x86-20131030
NDK: android-ndk-r9b

15 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de shenghong-geng (Intel)

Hi,

I have received your issue and will have a test soon, will come back to you as soon as possible (1 hour?)

Note: The official supported version of NDK is NDKr9. But usually, if NDK does not change too much, it should work for newer version too. I will download NDKr9b and test it. Please stay tuned.

Thanks,

Shenghong

imagem de shenghong-geng (Intel)

Hi

I have tested with NDKr9b, and it works for me. From your description, you see the error "Command Prompt Error" when you run "Build Environment for Android" cmd.exe? what is the exact error message? If possible, you may need to check below files:

C:\Intel\cc_android_14.0.0.014\bin\compilervars.bat

C:\Intel\cc_android_14.0.0.014\bin\compilervars_arch.bat

to see what is wrong. To run ICC as a standalone toolchain, you will need 2 environment variables:

ANDROID_SYSROOT and ANDROID_GNU_X86_TOOLCHAIN

They are set up in compilervars_arch.bat. You may have some issues to run the bat file in your cmd.exe (could you please debug the bat file to see which line cause the error in your system if you have some basics about bat programming?)

If you need a workaround, you can check whether the 2 environment variables are pointing to correct path using: "echo %ANDROID_SYSROOT%" and "echo %ANDROID_GNU_X86_TOOLCHAIN%", if these are wrong, you will get the "could not find directory in which i686-linux-android-g++.exe resides" error, you can set it manually to correct it, example:

set ANDROID_SYSROOT=%NDK_DIR%\platforms\android-18\arch-x86

set ANDROID_GNU_X86_TOOLCHAIN=%NDK_DIR%\toolchains\x86-4.6\prebuilt\windows

And it should work now.

 

By the way, to build hello-jni, you do not need to use ICC as standalone toolchain, it is suggested to use ndk-build script. See below:

1. open a cmd.exe and cd to the folder of hello-jni project

2. ..\..\ndk-build APP_ABI=x86 NDK_TOOLCHAIN=x86-icc

(you can add V=1 for ndk-build to see verbose information and you can see ICC is used)

Let me know your results and see where I can help.

Thanks,

Shenghong

imagem de Hide10

You're absolutely right. 
I used Intel C++ Compiler toolchain as standalone compiler (on D drive).
I referred to the following URL.
(http://software.intel.com/sites/products/documentation/doclib/stdxe/2013...)

■Result of Build Environment for Android
C:\Windows\system32>d:
D:\>D:\Intel\cc_android_14.0.0.014\bin\compilervars.bat
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel C++ Compiler 14.0 for Android*
D:\>set NDK_DIR=D:\android\android-ndk-r9b
D:\>set ANDROID_SYSROOT=%NDK_DIR%\platforms\android-18\arch-x86
D:\>set ANDROID_GNU_X86_TOOLCHAIN=%NDK_DIR%\toolchains\x86-4.6\prebuilt\windows
D:\>cd %NDK_DIR%\samples\hello-jni\jni
D:\android\android-ndk-r9b\samples\hello-jni\jni>icc -c hello-jni.c
icc: error #10001: could not find directory in which i686-linux-android-g++.exe resides

I’m sorry. I’m out now.
Further details will be provided until tomorrow noon.

Thank you for your information.

imagem de shenghong-geng (Intel)

Hi,

Thank you for your update. I tested again to install all stuff in D driver, and still cannot reproduce it. :( I have run all the commands you provided and it works for me. 

could you please check whether the path "%NDK_DIR%\toolchains\x86-4.6\prebuilt\windows" exists in your NDK (to make sure NDK is not missing files) ?

Also, if you start the cmd using the "Build Environment for Android" from start menu, you do NOT need to run "compilervar.bat" and set these environment variables (will be set up automatically), these are the manual steps to set up environment in a empty cmd.exe.

You only need to follow below steps:

1. open "Build Environment for Android"

2. run as below:

C:\Windows\system32>d:
D:\>cd %NDK_DIR%\samples\hello-jni\jni
D:\android\android-ndk-r9b\samples\hello-jni\jni>icc -c hello-jni.c

Setting ANDROID_SYSROOT and ANDROID_GNU_X86_TOOLCHAIN are only needed if you do not want to use the default value we set (example, you want to use a different android-platform like android-14). For a hello-jni project, it is not needed.

Summary: make sure the file "%ANDROID_GNU_X86_TOOLCHAIN%\bin\i686-linux-android-g++.exe" exists before running ICC, or you will get the error.

I will wait for your results tomorrow.

Thanks,

Shenghong

imagem de Hide10

Hi Shenghong,

I booted echo cmd and got the following result.

C:\Windows\system32>d:
D:\>echo %ANDROID_SYSROOT%
D:\android\android-ndk-r9b\platforms\android-18\arch-x86
D:\>echo %ANDROID_GNU_X86_TOOLCHAIN%
D:\android\android-ndk-r9b\toolchains\x86-4.6\prebuilt\windows
D:\>echo %ANDROID_GNU_X86_TOOLCHAIN%\bin\i686-linux-android-g++.exe%
D:\android\android-ndk-r9b\toolchains\x86-4.6\prebuilt\windows\bin\i686-linux-android-g++.exe%

All Path existed correct configurations.
But I couldn't boot "icc -c hello-jni.c".

C:\Windows\system32>d:
D:\>cd %NDK_DIR%\samples\hello-jni
D:\android\android-ndk-r9b\samples\hello-jni>icc -c hello-jni.c
icc: error #10236: File not found:  'hello-jni.c'
icc: command line error: no files specified; for help type "icc -help"

Although I couldn't the above-mentioned cmd, I could boot 'hello-jni.c' by the following cmd.

D:\>cd \android\android-ndk-r9b\samples\hello-jni
D:\android\android-ndk-r9b\samples\hello-jni>..\..\ndk-build APP_ABI=x86 NDK_TOO
LCHAIN=x86-icc
[x86] Gdbserver      : [x86-4.8] libs/x86/gdbserver
[x86] Gdbsetup       : libs/x86/gdb.setup
[x86] Compile x86    : hello-jni <= hello-jni.c
[x86] SharedLibrary  : libhello-jni.so
[x86] Install        : libhello-jni.so => libs/x86/libhello-jni.so

Then, I don't know how to debug the compilervars_arch.bat data.
Please let me know the debug operation, if it's operation is easy.

Thank you for your help.
Hide10

imagem de Hide10

Hi Shenghong,

I checked the path and got the following results. 

C:\Windows\system32>d:
D:\>echo %ANDROID_SYSROOT%
D:\android\android-ndk-r9b\platforms\android-18\arch-x86
D:\>echo %ANDROID_GNU_X86_TOOLCHAIN%
D:\android\android-ndk-r9b\toolchains\x86-4.6\prebuilt\windows
D:\>echo %ANDROID_GNU_X86_TOOLCHAIN%\bin\i686-linux-android-g++.exe%
D:\android\android-ndk-r9b\toolchains\x86-4.6\prebuilt\windows\bin\i686-linux-android-g++.exe%

All Path existed.
But I couldn't boot "icc -c hello-jni.c"

C:\Windows\system32>d:
D:\>cd %NDK_DIR%\samples\hello-jni\jni
D:\android\android-ndk-r9b\samples\hello-jni\jni>icc -c hello-jni.c
icc: error #10001: could not find directory in which i686-linux-android-g++.exe
resides

※I'm sorry. I was writing wrong cmd.
   The above-mentioned cmd is correct(= Bold Letters).

Although I couldn't boot the above-mentioned program, I could boot "icc -c hello-jni.c" by the following cmd.

D:\>cd \android\android-ndk-r9b\samples\hello-jni
D:\android\android-ndk-r9b\samples\hello-jni>..\..\ndk-build APP_ABI=x86 NDK_TOO
LCHAIN=x86-icc
[x86] Gdbserver      : [x86-4.8] libs/x86/gdbserver
[x86] Gdbsetup       : libs/x86/gdb.setup
[x86] Compile x86    : hello-jni <= hello-jni.c
[x86] SharedLibrary  : libhello-jni.so
[x86] Install        : libhello-jni.so => libs/x86/libhello-jni.so

Then, I don't know how to debug compilervars_arch.bat data.
Please let me know the debug operation, if it's operation is easy.

Thank you for yor help.
Hide10

imagem de shenghong-geng (Intel)

Hi,

If you did not see any error, you may not need to debug the compilervars_arch.bat, I ask you to debug it because at the very beginning, you mentioned you get "Command Prompt Error (by Build Environment for Android)", I thought you have some errors while starting the cmd.exe.

If ndk-build works, I think there are no big issues of your NDK environment.

Please check as below:

dir %ANDROID_GNU_X86_TOOLCHAIN%\bin\i686-linux-android-g++.exe

instead of "echo", echo will always print it as a string, or, you can manually check it, make sure the file "i686-linux-android-g++.exe" exists in the folder.

Also, could you please provide your environment values for PATH (echo %PATH%)? We have an very strange issue that was caused by PATH internally, I am not sure whether you may hit similar issues. The issue description is as below (this is really a rarely happen issue, I hope you are not hitting this bug):

I have a usb disk in which one of partition is formated as linux file system. When this USB disk is plugged in on windows host (windows 7), the window will map this partition with a drive label such as "f:\" but it is not accessable from windows actually. 

I have a path setting in the window PATH environment with this drive label. For example, PATH=xxx;f:\;yyy 



In this case, icc compiler for android on windows host will always fail with message: 

icc: error #10001: could not find directory in which i686-linux-android-g++.exe resides 

(you may also check your environment according to above description, for example, whether you have some special partition on your system, such as linux file system and so on...)

Let me know your results, and maybe you can start a clean/empty cmd.exe and set PATH with a minimal value to isolate the issue if it is caused by PATH, I will have a test and provide you the minimal values to make ICC-Android works.

Thanks,

Shenghong

imagem de shenghong-geng (Intel)

Hi,

I have found an interesting/similar issue when I tried to test out the minimal values for PATH and environment. First of all, could you please test as below to see whether it works?

1. open cmd.exe

2. run below commands:

C:\Users\sgeng2>D:

D:\>set PATH=

D:\>D:\testAndroid\Intel\cc_android_14.0.0.014\bin\compilervars.bat
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel C++ Compiler 14.0 for Android*

D:\>echo %PATH%
D:\testAndroid\Intel\cc_android_14.0.0.014\bin\ia32;

D:\>icc testAndroid\android-ndk-r9\samples\hello-jni\jni\hello-jni.c -c

D:\>

You will get hello-jni.o in D drive if no error happens. Hope this works for you. If it works, maybe there are some similar issue in your PATH settings, which break ICC to find android-g++.exe, please provide your PATH values for me to analysis.

 

I mentioned I found an interesting/similar issue above, it is:

D:\>set PATH=""

D:\>D:\testAndroid\Intel\cc_android_14.0.0.014\bin\compilervars.bat
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel C++ Compiler 14.0 for Android*

D:\>echo %PATH%
D:\testAndroid\Intel\cc_android_14.0.0.014\bin\ia32;""

D:\>icc testAndroid\android-ndk-r9\samples\hello-jni\jni\hello-jni.c -c
icc: error #10001: could not find directory in which i686-linux-android-g++.exe resides

It seems ICC is not smart to handle PATH values (very similar to the issue I mentioned in my last reply).

Thanks,

Shenghong

imagem de Hide10
Hello shenghong-geng(Intel):     Intel Forum site was down last week. So I sent you e-mail.
And I wrote down the comment on this site again. 

I saw your comment. I thought Environment variable is wrong.  So I re-installed my PC. And I tried to build Intel C++ Compiler for Android again. But I couldn't build it. The new programming error is as follows. (The file folder and path constitution is the same.)     C:\Windows\system32>d: D:\>echo %NDK_DIR% D:\android\android-ndk-r9b D:\>cd %NDK_DIR%\samples\hello-jni\jni D:\android\android-ndk-r9b\samples\hello-jni\jni>icc -c hello-jni.c D:\android\android-ndk-r9b\samples\hello-jni\jni>icc –shared –o libhello-jni.so hello-jni.o icc: error #10236: File not found:  'shared' icc: error #10236: File not found:  'o' icc: error #10236: File not found:  'libhello-jni.so'     Thank you for your help. Hide10

imagem de shenghong-geng (Intel)

Hi  Hide,

Yes, there are some issues for Intel Forum these days. But I did not receive your email. Whatever, I will reply here.

From your new testing results, the previous errors are fixed now!! Great! The new issue you get should be some typo error. You may need to check your typing carefully.

icc -shared (not --shared, whatever, do not try to copy from the help document, try to type by yourself, and make sure it is "-", not "--"). The same for the -o option.

From the error message, ICC regard 'shared' and 'o' as input file, I guess they are some type errors. Please check again and let me know your results.

icc -shared -o libhello-jni.so hello-jni.o

Thanks,

Shenghong

imagem de Hide10

Hi Shenghong,

You're absolutely right!
The letter was wrong.
I could solve this problem.
Thank you very much!!

But I failed at the next step.
I built "Application.mk"
This file changed contents.
Added messages are as follows.

APP_OPTIM=release
APP_CFLAGS:=-xATOM_SSSE3
APP_CFLAGS:=-xATOM_SSSE3 -O3
APP_CFLAGS:=-xATOM_SSSE3 -O3 -ipo

And I ran build command↓
(The letter is correct)
D:\android\android-ndk-r9b\samples\hello-jni\jni>ndk-build V=1 -B NDK_TOOLCHAIN=
x86-icc APP_ABI=x86 APP_OPTIM=release APP_CFLAGS=”-xATOM_SSSE3 -O3 -ipo”
→ERROR:'ndk-build'cmd was not recognized as programming or batch file. 

Please let me know how to deal with this problem.

Thanks,
Hide10

imagem de shenghong-geng (Intel)

Hi Hide,

It is great that you have finally resolved the issue.

Regarding the ndk-build cmd issue, you need to set it into PATH (set it globally in GUI, or set it in command line), below is how to set it in command line:

set PATH=<the directory of your NDK>;%PATH%

 

Or, you can also run with:

<the directory of your NDK>/ndk-build .....

Or, in your example, you can run with relative path like:

D:\android\android-ndk-r9b\samples\hello-jni\jni>..\..\..\ndk-build V=1 -B NDK_TOOLCHAIN=

x86-icc APP_ABI=x86 APP_OPTIM=release APP_CFLAGS=”-xATOM_SSSE3 -O3 -ipo”

Thanks,

Shenghong

imagem de Hide10

Hi Shenghong,

I could build this programming.
Thank you so much!!

I had a lot of troubles.
Without your support, I couldn't resolve these troubles.
Now,I'm happy!!

Thank you for your help,
Hide10

imagem de shenghong-geng (Intel)

Hi Hide10,

Enjoy our compiler. :) Hope it will be helpful to your application and boost performance.

Feel free to contact us if you have other questions.

Thanks,

Shenghong

Faça login para deixar um comentário.