java - Compiling Android JNI for OpenCV on Mac OSX -
bear me - long description, wanted include details. i'm trying use android ndk , jni building opencv android apps.
i'm following tutorial installed: http://www.stanford.edu/class/ee368/android/tutorial-2-opencv-for-android-setup-macintosh-api8.pdf
the following installed fine:
/usr/bin/g++ /usr/local/bin/swig /usr/bin/cmake /usr/bin/make /developer/pcre-8.32/
contents of .bashrc file:
export ndk=/users/me/code/android/android-ndk-r4-crystax export sdk=/users/me/code/android/adt-bundle-mac-x86_64-20130219/ export opcv=/users/me/code/opencv/opencv export path=$ndk:$sdk/tools:$sdk/platform-tools:$path export ndk_root=$ndk
making opencv libraries went fine.
due complaint in using make
, had make small edit in /users/me/code/opencv/opencv/android/android-jni/local.env.mk
looked so:
#android_ndk_root=$(home)/android-ndk-r4-crystax android_ndk_root=/users/me/code/android/android-ndk-r4-crystax
then upon trying again make
in android-jni, directory, disaster struck:
/users/me/code/android/android-ndk-r4-crystax/ndk-build opencv_config=../build/android-opencv.mk \ project_path= arm_targets="armeabi armeabi-v7a" v= gdbserver : [arm-eabi-4.4.0] /users/me/code/opencv/opencv/android/android-jni/libs/armeabi/gdbserver gdbsetup : /users/me/code/opencv/opencv/android/android-jni/libs/armeabi/gdb.setup gdbsetup : + source directory /users/me/code/opencv/opencv/android/android-jni/jni gdbserver : [arm-eabi-4.4.0] /users/me/code/opencv/opencv/android/android-jni/libs/armeabi-v7a/gdbserver gdbsetup : /users/me/code/opencv/opencv/android/android-jni/libs/armeabi-v7a/gdb.setup gdbsetup : + source directory /users/me/code/opencv/opencv/android/android-jni/jni sharedlibrary : libandroid-opencv.so /users/me/code/android/android-ndk-r4-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: cannot find -lopencv_calib3d collect2: ld returned 1 exit status make[1]: *** [/users/me/code/opencv/opencv/android/android-jni/obj/local/armeabi/libandroid-opencv.so] error 1 make: *** [libs/armeabi-v7a/libandroid-opencv.so] error 2
i thought perhaps pkg-config error, appears set well, though in old install of opencv. below output of pkg-config --cflags --libs opencv
:
-i/usr/include/opencv /usr/lib/libopencv_calib3d.dylib /usr/lib/libopencv_contrib.dylib /usr/lib/libopencv_core.dylib /usr/lib/libopencv_features2d.dylib /usr/lib/libopencv_flann.dylib /usr/lib/libopencv_gpu.dylib /usr/lib/libopencv_highgui.dylib /usr/lib/libopencv_imgproc.dylib /usr/lib/libopencv_legacy.dylib /usr/lib/libopencv_ml.dylib /usr/lib/libopencv_nonfree.dylib /usr/lib/libopencv_objdetect.dylib /usr/lib/libopencv_photo.dylib /usr/lib/libopencv_stitching.dylib /usr/lib/libopencv_ts.dylib /usr/lib/libopencv_video.dylib /usr/lib/libopencv_videostab.dylib
the install built particular tutorial has placed opencv.pc
file @ location:
/users/me/code/opencv/opencv/build/unix-install
but running below , trying make
again doesn't fix problem:
export pkg_config_path=$pkg_config_path:/users/me/code/opencv/opencv/build/unix-install
i can't figure out wrong. i've been battling problem month on , off, , needed outside opinions. ideas?
error message says
cannot find -lopencv_calib3d collect2: ld returned 1 exit status
it means linker can't find opencv_calib3d library. may have name libopencv_calib3d.a or libopencv_calib3d.so. need find 1 of them , add path file ld_library_path env variable.
i mean if let's folder /users/me/code/opencv/opencv/lib contains libopencv_calib3d.so need execute following before make:
export ld_library_path=/users/me/code/opencv/opencv/lib:$ld_library_path
Comments
Post a Comment