Prebuilt libtensorflowlite.so library in AOSP Android.bp, failes to build, permission denied

1.3k views Asked by At

I have a generated libtensorflowlite.so library from tensorflow with bazel, I've been using it with CMake for cross compile executable files and was able to run them all smoothly in android, but when I want to use that library (libtensorflowlite.so) in my AOSP build system as a prebuilt I get this error:
ERROR: out/target/product/*/obj_arm/SHARED_LIBRARIES/libtensorflowlite_prebuilted_intermediates/PACKED/libtensorflowlite_prebuilted.so: Permission denied

My module in Android.bp looks like:

cc_prebuilt_library_shared {
    name: "libtensorflowlite_prebuilted",
    host_supported: true,
    vendor_available: true,
    target: {
        android_arm: {
            srcs: ["prebuilt_libs/armeabi-v7a/libtensorflowlite.so"],
        },
        android_arm64: {
            srcs: ["prebuilt_libs/arm64-v8a/libtensorflowlite.so"],
        },
    },
    strip: {
        none:true,
    },
}

I was able to compile against the other pre-built libraries in the past with completely the same form of Android.bp and never face this error!

1

There are 1 answers

0
Flamur Berisha On

Was able to build successfully the same prebuilt shared library with Android.mk

include $(CLEAR_VARS)
LOCAL_MODULE := libtensorflowlite_prebuilted
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM := $(LOCAL_MODULE)
LOCAL_SRC_FILES_$(TARGET_ARCH) := prebuilt_libs/$(TARGET_ARCH)/libtensorflowlite.so
LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := prebuilt_libs/$(TARGET_2ND_ARCH)/libtensorflowlite.so
LOCAL_EXPORT_C_INCLUDE_DIRS := \
    $(LOCAL_PATH)/include
include $(BUILD_PREBUILT)

Yet the Android.bp approach fails, and yet don't know why!