(noob) Makefile directory problems?

178 views
Skip to first unread message

jeremy barrett

unread,
Jun 12, 2012, 11:33:44 AM6/12/12
to android...@googlegroups.com
i'm trying to compile a simple test program as a sanity check against my environ
ment setup.

aosp is installed in ~/src/aosp
opencv4android is installed in ~/src/OpenCV-2.4.0

here's my Android.mk:
===
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

OPENCV_LIB_TYPE:=STATIC
OPENCV_INSTALL_MODULES:=on
OPENCV_MK_PATH:=/home/jeremy/src/OpenCV-2.4.0/share/OpenCV/OpenCV.mk
include $(OPENCV_MK_PATH)

LOCAL_MODULE      := cvtest
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES   := cvtest.c

include $(BUILD_EXECUTABLE)
===

i had previously built the complete aosp (which includes opencv 1.1 .. ?), so ra
ther than a top-level make, i simply switch to my directory and execute mm, whic
h errors thusly:

make: *** No rule to make target `out/target/product/maguro/obj/STATIC_LIBRARIES
/opencv_contrib_intermediates/opencv_contrib.a', needed by `out/target/product/m
aguro/obj/EXECUTABLES/cvtest_intermediates/LINKED/cvtest'.  Stop.

i don't understand a couple of things here: 
-why is opencv_contrib.a a target? the library is already built, i'm just trying
 to link against it.
-why is the path to opencv_contrib.a listed as above? is the file supposed to be
 copied (automatically?) to out/target/product/maguro/obj/STATIC_LIBRARIES/openc
v_contrib_intermediates/ during the build process, or is there a path problem?

any insight?

jeremy barrett

unread,
Jun 12, 2012, 5:26:48 PM6/12/12
to android...@googlegroups.com
ok, after dumping the make database, i find the following target:

out/target/product/maguro/obj/EXECUTABLES/cvtest_intermediates/LINKED/cvtest: out/target/product/maguro/obj/lib/crtbegin_dynamic.o out/target/product/maguro/obj/EXECUTABLES/cvtest_intermediates/cvtest.o out/target/product/maguro/obj/lib/libc.so out/target/product/maguro/obj/lib/libstdc++.so out/target/product/maguro/obj/lib/libm.so out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_contrib_intermediates/opencv_contrib.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_legacy_intermediates/opencv_legacy.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_ml_intermediates/opencv_ml.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_stitching_intermediates/opencv_stitching.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_nonfree_intermediates/opencv_nonfree.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_objdetect_intermediates/opencv_objdetect.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_calib3d_intermediates/opencv_calib3d.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_ts_intermediates/opencv_ts.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_videostab_intermediates/opencv_videostab.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_photo_intermediates/opencv_photo.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_video_intermediates/opencv_video.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_features2d_intermediates/opencv_features2d.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_highgui_intermediates/opencv_highgui.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_androidcamera_intermediates/opencv_androidcamera.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_flann_intermediates/opencv_flann.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_imgproc_intermediates/opencv_imgproc.a out/target/product/maguro/obj/STATIC_LIBRARIES/opencv_core_intermediates/opencv_core.a out/target/product/maguro/obj/STATIC_LIBRARIES/tbb_intermediates/tbb.a out/target/product/maguro/obj/STATIC_LIBRARIES/libjpeg_intermediates/libjpeg.a out/target/product/maguro/obj/STATIC_LIBRARIES/libpng_intermediates/libpng.a out/target/product/maguro/obj/STATIC_LIBRARIES/libtiff_intermediates/libtiff.a out/target/product/maguro/obj/STATIC_LIBRARIES/libjasper_intermediates/libjasper.a out/target/product/maguro/obj/lib/crtend_android.o


the opencv libraries aren't found in out/target/product/maguro/obj/STATIC_LIBRARIES/* and hence make tries to find a rule to build these 'targets' . this is what's causing the build to fail.

the question is: are the libraries supposed to be copied, or is the makefile supposed to be using a different path to these objects (which happen to live in ~/src/OpenCV-2.4.0/libs/armeabi-v7a )?

i see in the make database for tutorial-3 that many files are copied around before the build. e.g.:

mkdir -p obj/local/armeabi-v7a/
echo
"Prebuilt       : libnative_camera_r2.2.0.so <= ../../OpenCV-2.4.0/share/OpenCV/../../libs/armeabi-v7a/"
cp
-f ../../OpenCV-2.4.0/share/OpenCV/../../libs/armeabi-v7a/libnative_camera_r2.2.0.so obj/local/armeabi-v7a/libnative_camera_r2.2.0.so
echo
"Install        : libnative_camera_r2.2.0.so => libs/armeabi-v7a/libnative_camera_r2.2.0.so"
mkdir
-p ./libs/armeabi-v7a
install
-p ./obj/local/armeabi-v7a/libnative_camera_r2.2.0.so ./libs/armeabi-v7a/libnative_camera_r2.2.0.so
/home/jeremy/tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip --strip-unneeded  ./libs/armeabi-v7a/libnative_camera_r2.2.0.so

however, nothing like this seems to be happening in my project.

two primary differences between my project and the tutorial are:
-tutorial is java+ndk, where my program is pure c for cli
-tutorial lives in the ~/src/OpenCV-2.4.0-samples directory, while my program's source lives in the aosp /external directory (that is, ~/src/aosp/external/mycvtest)

do either of these differences raise red flags? are there special procedures i need to perform in order to build this way? or would it be better if i reorganized my trees somehow first?

jeremy barrett

unread,
Jun 13, 2012, 12:47:34 PM6/13/12
to android...@googlegroups.com
this problem persists in 2.4.1 . it's not surprising, since OpenCV.mk did not change in the revision.
Reply all
Reply to author
Forward
0 new messages