大家好,我在windows下按照goolge到的资料,配置NDK,我下载的NDK包是android-ndk-r4-windows,但是在做第4步的时候,出现了问题,在build目录下,根本没有host-setup.sh文件,只有toolschain,tools,prebuild等几个目录,在tools目录下也没有这个sh文件。这是怎么回事,我当时装cygwin的是很,可是全部安装的,而且执行make -v和gcc -v看到的也没有问题3.执行桌面图标Cygwin,出现linux shell提示符后, 修改当前目录(/home/username)下.bash_profile文件, 加入如下内容在文件尾部
ANDROID_NDK_ROOT=/cygdrive/d/android-ndk-1.5_r1
export ANDROID_NDK_ROOT4.退出Cygwin,重新进入,执行以下命令
cd $ANDROID_NDK_ROOT
build/host-setup.sh
一切顺利的话会提示设置成功, 如果出错, 则检查错误并修复
ANDROID_NDK_ROOT=/cygdrive/d/android-ndk-1.5_r1
export ANDROID_NDK_ROOT4.退出Cygwin,重新进入,执行以下命令
cd $ANDROID_NDK_ROOT
build/host-setup.sh
一切顺利的话会提示设置成功, 如果出错, 则检查错误并修复
configure the NDK. However, this step has been removed in release 4 (a.k.a. r4).
E:\android-ndk-r4-windows\android-ndk-r4\samples\hello-jni\jni,执行ndk-build,就可以build ,并生产是so文件。今天还是同样做,却总提示command not found.
我之前在.bash_profile里面是这样写的:
ANDROID_NDK_ROOT =/cygdrive/e/android-ndk-r4-windows/android-ndk-r4
export ANDROID_NDK_ROOT
export PATH="$NDK_ROOT:$PATH"
真是困惑。
直接build是不对的
还有android-ndk-r4-windows已经不需要host-setup.sh这个文件了
是在这个目录执行ndk-build而不是在jni下。
build.sh: line 1: ndk-build: command not found
PROJECT_PATH defaulting to this directory
OPENCV_ROOT = ../
/home/Administrator/android-ndk-r4-crystax/ndk-build OPENCV_ROOT=../ \
PROJECT_PATH=. V=0
make[1]: Entering directory `/home/Administrator/android-opencv-read-only/opencv
/android'
Gdbserver : [arm-eabi-4.4.0] ./libs/armeabi/gdbserver
Gdbsetup : ./libs/armeabi/gdb.setup
Gdbsetup : + source directory /home/Administrator/android-opencv-read-only
/opencv/android/jni
Gdbserver : [arm-eabi-4.4.0] ./libs/armeabi-v7a/gdbserver
Gdbsetup : ./libs/armeabi-v7a/gdb.setup
Gdbsetup : + source directory /home/Administrator/android-opencv-read-only
/opencv/android/jni
SharedLibrary : libandroid-opencv.so
/home/Administrator/android-ndk-r4-crystax/build/prebuilt/windows/arm-eabi-4.4.0
/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: cannot find -lfeatur
es2d
collect2: ld returned 1 exit status
make[1]: *** [/home/Administrator/android-opencv-read-only/opencv/android/obj/lo
cal/armeabi/libandroid-opencv.so] Error 1
make[1]: Leaving directory `/home/Administrator/android-opencv-read-only/opencv/
android'
make: *** [libs/armeabi-v7a/libandroid-opencv.so] Error 2
请各位高手帮忙
$ $Android_NDK_ROOT/ndk-build
bash: /ndk-build: No such file or directoryAdministrator@wx-0024-5437 /cygdrive/e/android-ndk-r4b/samples/hello-jni
$ cd ..Administrator@wx-0024-5437 /cygdrive/e/android-ndk-r4b/samples
$ cd ..Administrator@wx-0024-5437 /cygdrive/e/android-ndk-r4b
$ /ndk-build -C samples/hello-neon
bash: /ndk-build: No such file or directoryAdministrator@wx-0024-5437 /cygdrive/e/android-ndk-r4b
$ ./ndk-build -C samples/hello-neon
make: Entering directory `/cygdrive/e/android-ndk-r4b/samples/hello-neon'
Compile thumb : helloneon <= /cygdrive/e/android-ndk-r4b/samples/hello-neon/jni
/helloneon.c
Compile thumb : cpufeatures <= /cygdrive/e/android-ndk-r4b/sources/cpufeatures/
cpu-features.c
StaticLibrary : libcpufeatures.a
SharedLibrary : libhelloneon.so
Install : libhelloneon.so => /cygdrive/e/android-ndk-r4b/samples/hello-ne
on/libs/armeabi
Compile thumb : helloneon <= /cygdrive/e/android-ndk-r4b/samples/hello-neon/jni
/helloneon.c
Compile thumb : helloneon <= /cygdrive/e/android-ndk-r4b/samples/hello-neon/jni
/helloneon-intrinsics.c
Compile thumb : cpufeatures <= /cygdrive/e/android-ndk-r4b/sources/cpufeatures/
cpu-features.c
StaticLibrary : libcpufeatures.a
SharedLibrary : libhelloneon.so
Install : libhelloneon.so => /cygdrive/e/android-ndk-r4b/samples/hello-ne
on/libs/armeabi-v7a
make: Leaving directory `/cygdrive/e/android-ndk-r4b/samples/hello-neon'Administrator@wx-0024-5437 /cygdrive/e/android-ndk-r4b
$
$ sh build.sh
build.sh: line 1: ndk-build: command not found
PROJECT_PATH defaulting to this directory
OPENCV_ROOT = ../
make clean-swig &&\
mkdir -p jni/gen &&\
mkdir -p src/com/opencv/jni &&\
swig -java -c++ -package "com.opencv.jni" \
-outdir src/com/opencv/jni \
-o jni/gen/android_cv_wrap.cpp jni/android-cv.i
PROJECT_PATH defaulting to this directory
OPENCV_ROOT = ../
make[1]: Entering directory `/cygdrive/d/cygwin/ethan/android-ndk-r4-crystax/and
roid-opencv/opencv/android'
rm -f jni/gen/android_cv_wrap.cpp
make[1]: Leaving directory `/cygdrive/d/cygwin/ethan/android-ndk-r4-crystax/andr
oid-opencv/opencv/android'
/usr/bin/swig.exe: error while loading shared libraries: cygstdc++-6.dll: cannot
open shared object file: No such file or directory
make: *** [jni/gen/android_cv_wrap.cpp] Error 127不知道是哪里出问题了。
Note that the -d switch is necessary for domain users.
/usr/bin/bash: /cygdrive/d/soft/android-ndk-1.6_r1/ndk-build: No such file or directory