Home > Software engineering >  error: missing opencv_features2d (STATIC_LIBRARIES android-arm)"
error: missing opencv_features2d (STATIC_LIBRARIES android-arm)"

Time:11-13

I've created an application to read QR code using OpenCv. When I try to build it using NDK, everything works well

NDK=/opt/android-ndk-r23c
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=aarch64-linux-android
export API=21
export AR=$TOOLCHAIN/bin/llvm-ar
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export AS=$CC
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang  
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
$NDK/ndk-build

But when I've tried to build it as a system application as part of the AOSP build I've got an error:

read_qr/jni/../../OpenCV-android-sdk/sdk/native/jni/OpenCV.mk: error: "read_qr (EXECUTABLES android-arm) missing opencv_features2d (STATIC_LIBRARIES android-arm)"
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.

read_qr/jni/../../OpenCV-android-sdk/sdk/native/jni/OpenCV.mk: error: "read_qr (EXECUTABLES android-arm) missing opencv_dnn (STATIC_LIBRARIES android-arm)"
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.

build/make/core/main.mk:1118: error: exiting from previous errors.
22:44:58 ckati failed with: exit status 1

And I have no idea what can be the problem. This is my Android.mk and Application.mk files:

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# Location of SDK on my drive
OPENCVROOT := ${LOCAL_PATH}/../../OpenCV-android-sdk
OPENCV_CAMERA_MODULES := off
OPENCV_INSTALL_MODULES := on
OPENCV_LIB_TYPE := STATIC
TARGET_ARCH_ABI := armeabi-v7a

include ${OPENCVROOT}/sdk/native/jni/OpenCV.mk

# Load your local .cpp and .h files here.
LOCAL_SRC_FILES := readQr.cpp

LOCAL_LDLIBS := -lm -llog -ldl -lz
LOCAL_CPPFLAGS  = -fexceptions -frtti -std=c  17
LOCAL_LDFLAGS  = -ljnigraphics

LOCAL_C_INCLUDES  = ${OPENCVROOT}/sdk/native/jni/include \
  ${OPENCVROOT}/sdk/native/jni/include/opencv2

LOCAL_EXPORT_C_INCLUDES  = ${OPENCVROOT}/sdk/native/jni/include \
  ${OPENCVROOT}/sdk/native/jni/include/opencv2

LOCAL_MODULE := read_qr

include $(BUILD_EXECUTABLE)

APP_PLATFORM := android-21

Application.mk

APP_STL := c  _static
APP_CPPFLAGS  = -fexceptions -frtti -std=c  11 -D__STDC_CONSTANT_MACROS

APP_ABI := armeabi-v7a
APP_PLATFORM := android-21

Can someone help me to understand what is the problem?

CodePudding user response:

Resolved by changing the Android.mk from:

include $(BUILD_EXECUTABLE)

to

include $(BUILD_STATIC_EXECUTABLE)
  • Related