Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

How to restrict Android.mk to compile a module to generate only 64bit library

I am able to integarte a 64 bit prebuilt library "x" in android for arm platform and when i try calling that libary in required module which will compile for both 32bit and 64bit library failed mentioning 32 bit library of "x" is not found. /out/target/product/xxxx/system/lib64/libxxxx.so

  1. prebuilt library makefile
    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := libfoo.so
    LOCAL_MODULE := libfoo
    LOCAL_MODULE_SUFFIX := .so
    LOCAL_MODULE_CLASS := SHARED_LIBRARIES
    LOCAL_MODULE_PATH := $(TARGET_OUT)/lib64
    LOCAL_MODULE_TAGS := debug
    LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
    include $(BUILD_PREBUILT
  1. Linking module Makefile
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := 
        test.c 
        
    LOCAL_SHARED_LIBRARIES := 
        liblog 
        libcutils 

    LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

    ifeq ($(TARGET_ARCH),arm64)
       LOCAL_SHARED_LIBRARIES   += libfoo.so
    endif

    LOCAL_CFLAGS += -Wall -Werror 
    LOCAL_MODULE := vtest
    LOCAL_MODULE_RELATIVE_PATH := test
    LOCAL_MODULE_TAGS := optional
    include $(BUILD_SHARED_LIBRARY)
ninja: error: 'out/target/product/xxxx/obj_arm/SHARED_LIBRARIES/libxxxx_intermediates/export_includes', needed by 'out/target/product/xxxx/obj_arm/SHARED_LIBRARIES/yyyyy/import_includes', missing and no known rule to make it

i want to restrict the linking module to build only for 64 bit not for 32 bit, i tried following but not working ifeq ($(TARGET_ARCH),arm64) LOCAL_SHARED_LIBRARIES += libxxx endif

Please provide suggestions to resolve this issue


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From https://source.android.com/setup/develop/64-bit-builds :

LOCAL_MODULE_TARGET_ARCH

Set this variable to a list of architectures, such as arm x86 arm64. If the architecture being built is in that list, the current module is included by the build system.

LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH

This variable is the opposite of LOCAL_MODULE_TARGET_ARCH. If the architecture being built is not in that list, the current module is included by the build system.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...