AOSP 7.1 failing to create a module with a prebuilt static library in system build.

276 views
Skip to first unread message

FlamurBerisha

unread,
Jul 22, 2019, 9:11:14 AM7/22/19
to Android Building
Hello everyone, thanks for helping.

I have an prebuilt  static library builted with ndk toolchain for cmake.  My lib is a simply a c++ class that says hello world on its constructor. 
Command which I invoke the cmake is : "cmake -DCMAKE_TOOLCHAIN_FILE=~/Android/Ndk/android-ndk-r19c/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a""

Than I created my module at external/new_module, there I putted the prebuilt_lib and the other src files that are linked to this lib. My Android.mk file looks like this.
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libdump_android_static
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILE := lib/arm64-v8a/../dump_android/libdump_android.a
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/../dump
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_PREBUILT)

When I execute the compile command for only this module "mmm ./external/new_module" it says that make completed successfully and also says " target Prebuilt: libdump_android_static (out/target/product/../obj/STATIC_LIBRARIES/libdump_android_static_intermediates/libdump_android_static.a"
Than I wanted to use this library in other sub-module which is builded inside the system, that sub-module inside my same Android.mk looks like:

include $(CLEAR_VARS)
LOCAL_MODULE := libdump
LOCAL_SRC_FILES := src/../dump/dump.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := liblog libopencv_core
LOCAL_STATIC_LIBRARIES := libdump_android_static
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)

When I execute the compile command for only this module "mmm ./external/new_module" it says: 
ninja: error: 'out/target/product/../obj_arm/STATIC_LIBRARIES/libdump_android_static_intermediates/export_includes', needed by 'out/target/product/../obj_arm/SHARED_LIBRARIES/libdump_intermediates/import_includes', missing and no known rule to make it.
I also tried with shared libraries but the same error appears!

Dan Willemsen

unread,
Jul 22, 2019, 11:37:14 AM7/22/19
to Android Building
Use `mmma` or `m libdump` instead of `mmm`, at least once. I suspect that will fix it up. Note that to be correct, you need to specify LOCAL_SDK_VERSION := <version cmake used>, since you compiled with the NDK.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/91f9bda2-f1ef-4a54-a0a9-d041b7bb0222%40googlegroups.com.

FlamurBerisha

unread,
Jul 23, 2019, 12:14:15 PM7/23/19
to Android Building
Hello and thank you for your reply. I tried `mmma` and `m libdump` they still not compile with the same error, I added the LOCAL_SDK_VERSION to the libdump_android_static module and tried `m libdump_android_static` and it succeeds!

- Flamur

For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-...@googlegroups.com.

FlamurBerisha

unread,
Jul 25, 2019, 10:28:25 AM7/25/19
to Android Building
Do we have another solution for this! 
Reply all
Reply to author
Forward
0 new messages