Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling Android JNI for OpenCV on Mac OSX
    text
    copied!<p>Bear with me - this is a long description, but I wanted to include all details. I'm trying use android NDK and JNI for building OpenCV Android apps. </p> <p>I'm following this tutorial to get everything installed: <a href="http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API8.pdf">http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API8.pdf</a></p> <p>The following installed just fine:</p> <pre><code>/usr/bin/g++ /usr/local/bin/swig /usr/bin/cmake /usr/bin/make /Developer/pcre-8.32/ </code></pre> <p>Contents of my .bashrc file:</p> <pre><code>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 </code></pre> <p>Making OpenCV libraries went just fine. </p> <p>Due to complaint in using <code>make</code>, I had to make a small edit in <code>/Users/Me/Code/OpenCV/opencv/android/android-jni/local.env.mk</code> which looked like so: </p> <pre><code>#ANDROID_NDK_ROOT=$(HOME)/android-ndk-r4-crystax ANDROID_NDK_ROOT=/Users/Me/Code/Android/android-ndk-r4-crystax </code></pre> <p>Then upon trying again to <code>make</code> in the android-jni, directory, disaster struck:</p> <pre><code>/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 </code></pre> <p>I thought perhaps this was a pkg-config error, but that appears to be set up as well, though in my old install of OpenCV. Below is the output of <code>pkg-config --cflags --libs opencv</code>:</p> <pre><code>-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 </code></pre> <p>The install built by this particular tutorial has placed an <code>opencv.pc</code> file at this location:</p> <pre><code>/Users/Me/Code/OpenCV/opencv/build/unix-install </code></pre> <p>BUT Running the below and trying <code>make</code> again doesn't fix the problem:</p> <pre><code>export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/Me/Code/OpenCV/opencv/build/unix-install </code></pre> <p>I can't figure out what is wrong. I've been battling with this problem for about a month on and off, and finally needed some outside opinions. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload