2016-10-10 392 views
0

Android.mk鏈接的libjpeg不會跟OpenCV的Android上

LOCAL_PATH:=$(call my-dir) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_core 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_core.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_calib3d 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_calib3d.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_videostab 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_videostab.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_videoio 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_videoio.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_video 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_video.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_shape 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_shape.a 

include $(PREBUILT_STATIC_LIBRARY) 

ifeq ($(APP_ABI),armeaby-v7a) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_ts 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_ts.a 

include $(PREBUILT_STATIC_LIBRARY) 

endif 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_superres 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_superres.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_stitching 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_stitching.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_photo 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_photo.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_flann 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_flann.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_objdetect 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_objdetect.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_ml 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_ml.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_imgcodecs 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_imgcodecs.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_features2d 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_features2d.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_highgui 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_highgui.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libopencv_imgproc 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/libs/$(APP_ABI)/libopencv_imgproc.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libtbb 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/libtbb.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := libIlmImf 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/libIlmImf.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := liblibjasper 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/liblibjasper.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := liblibjpeg 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/liblibjpeg.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := liblibpng 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/liblibpng.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := liblibtiff 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/liblibtiff.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := liblibwebp 
LOCAL_SRC_FILES := $(LOCAL_PATH)/opencv_precompiled/3rdparty/libs/$(APP_ABI)/liblibwebp.a 

include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS) 

LOCAL_C_INCLUDES := $(LOCAL_PATH)/eigen\ 
$(LOCAL_PATH)/inc\ 
$(LOCAL_PATH)/opencv_precompiled/include\ 

LOCAL_MODULE:=blend 
LOCAL_SRC_FILES:=$(LOCAL_PATH)/src/poisson_solver.cpp $(LOCAL_PATH)/src/clone.cpp $(LOCAL_PATH)/src/seamless_cloning.cpp 
LOCAL_LDLIBS += -lz -llog -landroid -ldl -lm -ljnigraphics 
LOCAL_STATIC_LIBRARIES := libopencv_shape libopencv_stitching libopencv_objdetect libopencv_superres libopencv_videostab libopencv_calib3d\ 
libopencv_features2d libopencv_highgui libopencv_videoio libopencv_imgcodecs libopencv_video libopencv_photo\ 
libopencv_ml libopencv_imgproc libopencv_flann libopencv_core\ 
liblibjpeg liblibwebp liblibpng liblibtiff liblibjasper libIlmImf libtbb\ 

ifeq ($(APP_ABI),armeaby-v7a) 
LOCAL_LDLIBS += libopencv_ts 
endif 

include $(BUILD_SHARED_LIBRARY) 

include $(CLEAR_VARS) 
LOCAL_MODULE := cpu_info-jni 
LOCAL_SRC_FILES := $(LOCAL_PATH)/src/utils.cpp 

include $(BUILD_SHARED_LIBRARY) 

Application.mk

NDK_TOOLCHAIN_VERSION := 4.9 
APP_ABI := arm64-v8a 
APP_CPPFLAGS += -std=c++11 -fexceptions 
APP_STL := gnustl_static 

這是錯誤我得到:

/home/pedja/workspace/Projekat/android/src/main/jni/opencv_precompiled/libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function `cv::my_jpeg_load_dht(jpeg_decompress_struct*, unsigned char*, JHUFF_TBL**, JHUFF_TBL**) [clone .constprop.52]': 
grfmt_jpeg.cpp:(.text.unlikely._ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.52+0x104): undefined reference to `jpeg_alloc_huff_table' 
/home/pedja/workspace/Projekat/android/src/main/jni/opencv_precompiled/libs/arm64-v8a/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): In function `cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)': 

完整的錯誤: Error

回答

0

回答我自己的問題。

由於某些原因,本地靜態庫的模塊名稱不能爲:「liblibjpeg」爲例。 將模塊liblibjpeg(和其他以lib開頭的庫)重命名爲libjpeg後,它成功鏈接。