when I am Trying to compile native C code like this:
:~/com.***.sample.ndk1$ ./ndk-build
Android NDK: Could not find platform files (headers and libraries)
Android NDK: Please run build/tools/build-platforms.sh to build the corresponding directory.
/com.***.sample.ndk1/build/core/init.mk:345: *** Android NDK: Aborting . Stop.
:~/com.***.sample.ndk1$ build/tools/build-platforms.sh
.: 39: Can't open build/tools/../core/ndk-common.sh
:~/com.***.sample.ndk1$
The above error is shows.
Could anyone answer to solve this problem?
You have to add the Your NDK location directory to Your system PATH variable:
let suppose your ndk is in /opt/android/android-ndk-r8b folder, android sdk is in /opt/android/android-sdk folder
so, you may add the following lines to your ~/.bash_profile (at the end of file) :
export PATH=$PATH:/opt/android/android-ndk-r8b:/opt/android/android-sdk
in addition You can run the following commands:
chmod -R a+r /opt/android/android-ndk-r8b
chmod -R a+r /opt/android/android-sdk
Related
How to solve artoolkit nftBook issues in android studio
When I run the command ndk-build in android studio terminal for nft book it shows the error like:
clang++.exe: error: linker command failed with exit code 1 (use -v to
see invocation) make: *** [obj/local/armeabi/libnftBookNative.so]
Error 1
How can I solve this?
You should not run it in the android studio terminal but in the Git-Bash.
Read the documentation more closely :).
You look like you are working from Windows so you need to use Git-Bash for compilation.
See: http://artoolkit.org/community/forums/viewtopic.php?f=26&t=17092
===========
EDIT:
Make sure you have these environment variables set:
- Set ANDROID_HOME to indicate the path to root folder of the downloaded Android SDK.
Set ANDROID_NDK_ROOT to indicate the path to root folder (most likely, “ndk-bundle”) of the downloaded NDK. The ANDROID_HOME environment variable can be used to help define NDK.
ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle
Set NDK to the same path as ANDROID_NDK_ROOT. NDK=$ANDROID_NDK_ROOT
Set PATH to include a path to the ndk-build[.cmd] script file, that is, the path to the root folder of the NDK. The NDK environment variable can be used to help define the added path.
Now start gitBash and navigate to your ARToolKit5_ROOT directory.
cd android
./build.sh
if successful
./build_native_examples.sh
I'm new to Linux (Ubuntu) and I had a problem building the libraries in my project.
I added the android ndk to the PATH like this:
export PATH=$PATH:/android-ndk-r9b
and to Eclipse
but when I try to use the
ndk-build
command, I get this output:
ndk-build: command not found
Any help?
Your PATH should include the root directory of your NDK:
export PATH=$PATH:/home/.../android-ndk-xxx
I am not able to get rid of this error when I start compiling helloCpp with ndk. I am given proper permission to all users. Please can any one give clue? I included NDK_ROOT also in system variables.
dell#dell-PC /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android
$ ./build_native.sh
NDK_ROOT = /cygdrive/C/android-ndk-r8e
COCOS2DX_ROOT = /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android/../../../..
APP_ROOT = /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android/..
APP_ANDROID_ROOT = /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android Using prebuilt externals
++ /cygdrive/C/android-ndk-r8e/ndk-build -C /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android NDK_MODULE_PATH=/cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android/../../../..:/cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android/../../../../cocos2dx/platform/third_party/android/prebuilt
make.exe: *** /cygdrive/C/cocos2d-x/samples/Cpp/HelloCpp/proj.android: No such file or directory. Stop.
Follow this tutorial here.
Include these in path and symbols <- C/C++ General<- Properties <- Right Click on Project
Browse and set where you have your NDK Installed.
/Library/Android/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include
/Library/Android/android-ndk-r8/platforms/android-8/arch-arm/usr/include
/Library/Android/android-ndk-r8/sources/cxx-stl/system/include
/Library/Android/android-ndk-r8/sources/cxx-stl/gabi++/include
Under Build->Toolchain Select Android Gcc -> make then reset the
variable under C/C++ build -> build command
reset it to
bash ${workspace_loc:/YOURPROJECTNAME}/build_native.sh NDK_DEBUG=1 V=1
Don't forget to change the project name in the build command.
i have downloaded the latest android ndk r8b on my ubuntu 12.10 beta 2 .
i have included the ndk directory in the PATH variable (when i write ndk-b in terminal and hit tab it auto-completes it) .
but when i try :
cd android-ndk/samples/san-angeles/jni
ndk-build
i get this error:
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
Compile thumb : sanangeles <= importgl.c
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: *** [/home/mixpro/Android/android-ndk/samples/san-angeles/obj/local/armeabi/objs/sanangeles/importgl.o] Error 127
when checking the /android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin directory using ls i get:
arm-linux-androideabi-addr2line arm-linux-androideabi-g++
arm-linux-androideabi-gdbtui arm-linux-androideabi-size
arm-linux-androideabi-c++filt arm-linux-androideabi-gcc-4.6.x-google
arm-linux-androideabi-gprof arm-linux-androideabi-strings
arm-linux-androideabi-cpp arm-linux-androideabi-gcov
arm-linux-androideabi-readelf arm-linux-androideabi-elfedit
arm-linux-androideabi-gdb arm-linux-androideabi-run
meaning there is no arm-linux-androideabi-gcc in the directory
I am afraid that somehow you got arm-linux-androideabi-addr2line arm-linux-androideabi-gcc deleted. On linux, it is just a symlink to arm-linux-androideabi-gcc-4.6.x-google, so it's very easy to restore it. But maybe, to be on the safe side, it's worthwhile to reinstall NDK.
you should create symbolic link like this : ln -s /usr/bin/arm-linux-gnueabi-gcc-4.7 "/home/sofien/Bureau/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc"
I want to know how to build libav on windows7 using cygwin. I've tried the following steps :
1-change the directory using cd command to libav_file_directory/android(android folder is empty where the .so file will be saved as far as my knowledge is concern).
2-execute the ./ndk-buil command.
I got the following as result:
*Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/c/Users/balwant.singh.TA/Desktop/Android/android-ndk-r8/build/core/build-local.mk:130: * Android NDK: Aborting . Stop.*
plese reply with solution, and also I want to know which all android media player uses the libav as their native code.
1.)Set all your paths(Java_Home
2.)Set NDK_HOME to Ndk-Build Path
3.)Run Cygwin
4.)GO to project Library path
5.)Run make command
6.)then Run ndk-build