How to add shared libraries dependence to art on Android Q?

867 views
Skip to first unread message

Gavin Fung

unread,
Sep 5, 2019, 12:41:54 AM9/5/19
to Android Building
Dear android-building team,
    Hello, I am a personal developer focus on AOSP.
    I am getting stuck in how to add shared libraries dependence to art on Android Q.

I want to add libcutils.so and libprocessgroup.so to libart================
diff --git a/compiler/Android.bp b/compiler/Android.bp
old mode 100644
new mode 100755
index 52bd89f..b0e2981
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -174,6 +174,10 @@ art_cc_defaults {
     generated_sources: ["art_compiler_operator_srcs"],
     shared_libs: [
         "libbase",
+        "libcutils",
+        "libprocessgroup",
     ],
     include_dirs: ["art/disassembler"],
     header_libs: [
diff --git a/runtime/Android.bp b/runtime/Android.bp
old mode 100644
new mode 100755
index cb675f9..e777dda
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -398,6 +398,10 @@ libart_cc_defaults {
         "libnativeloader",
         "libbacktrace",
         "liblog",
+        "libcutils",
+        "libprocessgroup",
         // For common macros.
         "libbase",
     ],
================================================================

then get these build errors.===========================================
FAILED: out/soong/.intermediates/art/build/apex/art-check-debug-apex-gen/gen/art-check-debug-apex-gen.dummy
out/soong/host/linux-x86/bin/sbox --sandbox-path out/soong/.temp --output-root out/soong/.intermediates/art/build/apex/art-check-debug-apex-gen/gen -c 'out/soong/host/linux-x86/bin/art-apex-tester --debugfs out/soong/host/linux-x86/bin/debugfs --tmpdir __SBOX_OUT_DIR__ --debug out/soong/.intermediates/art/build/apex/com.android.runtime.debug/android_common_com.android.runtime.debug/com.android.runtime.debug.apex && touch __SBOX_OUT_FILES__'  __SBOX_OUT_DIR__/art-check-debug-apex-gen.dummy
--bitness=auto, trying to autodetect. This may be incorrect!
  Detected multilib
Unexpected file 'lib/libcutils.so'
Unexpected file 'lib/libprocessgroup.so'
Unexpected file 'lib64/libcutils.so'
Unexpected file 'lib64/libprocessgroup.so'
No superfluous libraries checker FAILED
  ================================================================ 

 By looking up the root casue of this error, I find out art/build/apex/art_apex_test.py doesn't allow superfluous libraries add to com.android.runtime apex image.

But with the old way to add shared libraries would alway build those apex specific libraries:=====
out/target/product/qssi/obj_arm/SHARED_LIBRARIES/com.android.runtime.debug.libprocessgroup_intermediates
out/target/product/qssi/obj_arm/SHARED_LIBRARIES/com.android.runtime.debug.libcutils_intermediates
================================================================ 

    That is my confusion about how to add shared libraries dependence to art on Android Q. Please kindly help me.

Orion Hodson

unread,
Sep 6, 2019, 10:07:39 AM9/6/19
to Android Building
In Android Q, ART is part of the Runtime Module (installed as an APEX). It's part of the Mainline Modules work in Android.

The libraries you are attempting to add are system libraries. When you add those dependencies, they'll get pulled into the APEX. These libraries may not work across Android releases.

ART dependencies on system libraries are now plumbed through libartpalette (n. palette, small platform-abstraction layer :-) which sits between the platform and ART.

This is part of enabling ART to update independently from the rest of the system.

There is still work left to do on the Runtime Module which means that it is not signed and not updatable in Android Q.

If you really want to put these system libraries in your private ART, you may be able to just disable the check. Or you can plumb your changes through the abstraction.

Thanks
Orion
Reply all
Reply to author
Forward
0 new messages