Adding a shared library to the `art` folder of the Android AOSP.

266 переглядів
Перейти до першого непрочитаного повідомлення

pdf.pa...@gmail.com

не прочитано,
12 лист. 2015 р., 16:18:0912.11.15
Кому: Android Building
Hello all,

I am trying to add a library which extends oatdump, but location-wise independent of it and want it to be built as a `shared library` instead of an executable (like oatdump)
I have done the following things, but for some reason the library is never built.

  • If the root of my android AOSP is <root>, I have created a new folder <root>/art/myoatdump with the source file myoatdump.cc and the Makefile Android.mk
  • The contents of the Android.mk file,

LOCAL_PATH := $(call my-dir)

include art/build/Android.common_build.mk

MY_SRC_FILES := \
    myoatdump.cc

# $(1): target or host
# $(2): ndebug or debug
define build-libart-myoatdump
  ifneq ($(1),target)
    ifneq ($(1),host)
      $$(error expected target or host for argument 1, received $(1))
    endif
  endif
  ifneq ($(2),ndebug)
    ifneq ($(2),debug)
      $$(error expected ndebug or debug for argument 2, received $(2))
    endif
  endif

  art_target_or_host := $(1)
  art_ndebug_or_debug := $(2)

  include $(CLEAR_VARS)
  ifeq ($$(art_target_or_host),host)
     LOCAL_IS_HOST_MODULE := true
  endif
  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
  ifeq ($$(art_ndebug_or_debug),ndebug)
    LOCAL_MODULE := libart-myoatdump
  else # debug
    LOCAL_MODULE := libartd-myoatdump
  endif

  LOCAL_MODULE_TAGS := optional
  LOCAL_MODULE_CLASS := SHARED_LIBRARIES

  LOCAL_SRC_FILES := $$(
MY_SRC_FILES)

  ifeq ($$(art_target_or_host),target)
      $(call set-target-local-clang-vars)
      $(call set-target-local-cflags-vars,$(2))
  else # host
    LOCAL_CLANG := $(ART_HOST_CLANG)
    LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
    ifeq ($$(art_ndebug_or_debug),debug)
      LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
    else
      LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
    endif
  endif

  LOCAL_SHARED_LIBRARIES += liblog
  ifeq ($$(art_ndebug_or_debug),debug)
    LOCAL_SHARED_LIBRARIES += libartd
  else
    LOCAL_SHARED_LIBRARIES += libart
  endif

  ifeq ($$(art_ndebug_or_debug),debug)
    LOCAL_SHARED_LIBRARIES += libart-disassembler
  else
    LOCAL_SHARED_LIBRARIES += libartd-disassembler
  endif

  LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime art/disassembler

  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
  LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
  include external/libcxx/libcxx.mk
  ifeq ($$(art_target_or_host),target)
    LOCAL_SHARED_LIBRARIES += libcutils libvixl
    include $(BUILD_SHARED_LIBRARY)
  else # host
    LOCAL_STATIC_LIBRARIES += libcutils libvixl
    include $(BUILD_HOST_SHARED_LIBRARY)
  endif
endef

ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
  $(eval $(call
build-libart-myoatdump,target,ndebug))
endif
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
  $(eval $(call
build-libart-myoatdump,target,debug))
endif

ifeq ($(ART_BUILD_NDEBUG),true)
  $(eval $(call
build-libart-myoatdump,host,ndebug))
endif

ifeq ($(ART_BUILD_DEBUG),true)
  $(eval $(call
build-libart-myoatdump,host,debug))
endif


This is derived from the makefile used in for the libart-disaseembler library but with the required changes to compile the changed oatdump. What am I doing wrong here?. myoatdump.cc is never compiled.

Dave Smith

не прочитано,
12 лист. 2015 р., 17:40:0512.11.15
Кому: android-...@googlegroups.com, pdf.pa...@gmail.com
The target your building needs to somehow include to a directive that your brand new module should be included in the overall build. AOSP won’t automatically discover and build your module by virtue of it having an Android.mk file.

Given the structure of the rest of the libart build, my first guess would be that you need include your new product rules file with the others found in <root>/art/Android.mk (http://androidxref.com/6.0.0_r1/xref/art/Android.mk#77). If that doesn’t work, you may need to add your build’s LOCAL_MODULE name directly to your target’s packages list.

Cheers,
-- 
Dave Smith, PE
@devunwired
--
--
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.
For more options, visit https://groups.google.com/d/optout.
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень