Static prebuilt libraries are not getting copied to intermediary folders

488 views
Skip to first unread message

Kartik Aiyer

unread,
Jun 19, 2018, 4:04:08 PM6/19/18
to android-platform

Hello,
I’m trying to use prebuilt static libraries and link them to another
static library that I’m building in the AOSP build. The prebuilts are
dependencies for which I have architecture specific versions.

The Core/App Module depends on the opencv prebuilds. Here is my folder structure

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

Android.mk file for the Vendor folder.

It contains one built static lib and four prebuilds of both 32 & 64 bit flavor

#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)

The Android.mk file of the library (Core/App) that is built by AOSP and depends on the prebuilt static STATIC_LIBRARIES

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)

I have not added anything to the PRODUCT_PACKAGES of the device config file. I
expect the resulting Core/App library to be able to find its dependencises
which it seems to during the build however it looks like the prebuilt targets
are not getting copied to the Intermediary folders. Primarily it looks like
the copy command for the PREBUILT is copying the $LOCAL_PATH as a folder and not the SRC file.
Here is the build output 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.

Please note the following

/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/

Why is it copying vendor/rylo/Core/Vendor/core-libs/opencv/Android/sdk/native/libs/ which is the LOCAL_PATH variable instead of the
LOCAL_SRC_FILES variable contents?

Any help will be much appreciated.

Thanks
Kartik

Colin Cross

unread,
Jun 19, 2018, 4:39:25 PM6/19/18
to android-...@googlegroups.com
LOCAL_PATH should point to the path to the Android.mk using $(call my-dir).  Adjust the paths in LOCAL_SRC_FILES to be relative to the location of the Android.mk.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages