我尝试使用预构建的静态库并将它们链接到另一个 我在AOSP构建中构建的静态库。预制件是 我有架构特定版本的依赖项。
Core / App Module依赖于opencv预建。这是我的文件夹结构
Core
├── Android.mk
├── Core
│ ├── Android.mk
│ ├── App
│ │ ├── Android.mk
| | | ...
│ ├── App.h
│ ├── Base
│ │ ├── Algorithm.cpp
│ │ ├── Algorithm.h
| | | Android.mk
| | | ...
│ ├── Base.h
│ ├── Core.h
│ ├── GL
│ │ ├── Android.mk
│ │ └── GLWarpVertexRenderer.h
| | | ...
│ ├── GL.h
│ ├── Log
│ │ ├── Android.mk
| | | ...
│ ├── Log.h
└── Vendor
├── Android.mk
├── core-libs
│ ├── opencv
│ │ ├── Android
│ │ │ ├── cmake_android_all.sh
│ │ │ └── sdk
│ │ │ └── native
│ │ │ ├── 3rdparty
│ │ │ │ └── libs
| | | | ...
│ │ │ ├── jni
│ │ │ │ ├── android.toolchain.cmake
│ │ │ │ ├── include
│ │ │ │ │ ├── opencv
│ │ │ │ │ │ ├── cvaux.h
| | | | | | ...
│ │ │ │ │ └── opencv2
│ │ │ │ │ ├── core
│ │ │ └── libs
│ │ │ ├── arm64-v8a
│ │ │ │ ├── libopencv_core.a
│ │ │ │ ├── libopencv_features2d.a
│ │ │ │ ├── libopencv_imgproc.a
│ │ │ │ └── libopencv_video.a
│ │ │ ├── armeabi-v7a
│ │ │ │ ├── libopencv_core.a
│ │ │ │ ├── libopencv_features2d.a
│ │ │ │ ├── libopencv_imgproc.a
│ │ │ │ └── libopencv_video.a
│ │ │ ├── x86
│ │ │ │ ├── libopencv_core.a
│ │ │ │ ├── libopencv_features2d.a
│ │ │ │ ├── libopencv_imgproc.a
│ │ │ │ └── libopencv_video.a
│ │ │ └── x86_64
│ │ │ ├── libopencv_core.a
│ │ │ ├── libopencv_features2d.a
│ │ │ ├── libopencv_imgproc.a
│ │ │ └── libopencv_video.a
├── Eigen
| ├── ...
|
└── fmt
├── Android.mk
...
245 directories, 1743 files
它包含一个内置的静态库和四个预构建的32和32。 64位风味
#This build fmt and also exports the inlcude path to Eigen
#Link this with all Core components as a dependency
ROOT_DIR := $(call my-dir)
LOCAL_PATH := $(ROOT_DIR)/core-libs/opencv/Android/sdk/native/libs
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_core_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILES_arm := armeabi-v7a/libopencv_core.a
LOCAL_SRC_FILES_arm64 := arm64-v8a/libopencv_core.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../jni/include
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_features2d_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILE_arm := armeabi-v7a/libopencv_features2d.a
LOCAL_SRC_FILE_arm64 := arm64-v8a/libopencv_features2d.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_imgproc_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILE_arm := armeabi-v7a/libopencv_imgproc.a
LOCAL_SRC_FILE_arm64 := arm64-v8a/libopencv_imgproc.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_video_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILE_arm := armeabi-v7a/libopencv_video.a
LOCAL_SRC_FILE_arm64 := arm64-v8a/libopencv_video.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include
include $(BUILD_PREBUILT)
LOCAL_PATH := $(ROOT_DIR)
include $(CLEAR_VARS)
LOCAL_CPPFLAGS += -std=c++11 -fexceptions
LOCAL_MODULE := com.rylo.coreDeps
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fmt/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/fmt/include \
$(LOCAL_PATH)/Eigen
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := fmt/src/format.cc
include $(BUILD_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../..\
$(LOCAL_PATH)/../../Vendor/Eigen
LOCAL_CPPFLAGS := -Wno-error -Wno-mismatched-tags
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../..
LOCAL_EXPORT_CPPFLAGS := -Wno-error -Wno-mismatched-tags
LOCAL_SRC_FILES := $(call all-cpp-files-under, . )
LOCAL_STATIC_LIBRARIES := com.rylo.coreDeps \
opencv_core_prebuilt \
opencv_features2d_prebuilt \
opencv_imgproc_prebuilt \
opencv_video_prebuilt
LOCAL_MODULE := com.rylo.coreApp
include $(BUILD_STATIC_LIBRARY)
我没有在设备配置文件的PRODUCT_PACKAGES中添加任何内容。我希望生成的Core / App库能够找到它的依赖项 它似乎在构建期间,但看起来预建目标没有被复制到中介文件夹。主要看起来PREBUILT的复制命令是将$ LOCAL_PATH复制为文件夹而不是SRC文件。
这是构建输出Log
[ 66% 2/3] glob vendor/*/*/*/*/*/Android.bp
[ 1% 3/155] target Prebuilt: opencv_video_pr...ebuilt_intermediates/opencv_video_prebuilt.a)
FAILED: out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
[ 2% 4/155] target Prebuilt: opencv_video_pr...ebuilt_intermediates/opencv_video_prebuilt.a)
FAILED: out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
[ 3% 5/155] target Prebuilt: opencv_features...t_intermediates/opencv_features2d_prebuilt.a)
FAILED: out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
[ 3% 6/155] target Prebuilt: opencv_imgproc_...uilt_intermediates/opencv_imgproc_prebuilt.a)
FAILED: out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
[ 4% 7/155] target Prebuilt: opencv_imgproc_...uilt_intermediates/opencv_imgproc_prebuilt.a)
FAILED: out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_imgproc_prebuilt_intermediates/opencv_imgproc_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
[ 5% 8/155] target Prebuilt: opencv_features...t_intermediates/opencv_features2d_prebuilt.a)
FAILED: out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a
/bin/bash -c "(rm -f out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ out/target/product/qcs605/obj_arm/STATIC_LIBRARIES/opencv_features2d_prebuilt_intermediates/opencv_features2d_prebuilt.a )"
cp: omitting directory ‘vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/’
ninja: build stopped: subcommand failed.
请注意以下内容
/bin/bash -c "(rm -f out/target/product/qcs605/obj/STATIC_LIBRARIES/opencv_video_prebuilt_intermediates/opencv_video_prebuilt.a ) && (cp vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/
为什么要复制vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/
这是LOCAL_PATH变量而不是
LOCAL_SRC_FILES变量内容?
非常感谢任何帮助。
由于 卡尔蒂克