Hi Kunal

If you are building for host, use the buildbot-build.sh script.

Your command-line is building for a silvermont device so attempting to
build a lot more than you need.

The prebuilts are just that: prebuilts, they are not intended for
modification. If you want to add a library to ART look at the libraries
already under art/, e.g. libartbase.

Whilst rust is interesting, it's not something we have a specific use for
in ART at the moment: no data / pointers on how to do that for the time
being.

Thanks
Orion


On Wed, 16 Nov 2022 at 19:09, Kunal Sareen <[email protected]>
wrote:

> Hi Orion,
>
> Thank you for the tips! I'm now attempting to add a simple prebuilt
> library to the ART runtime, but I can't seem to get it to link properly.
> What I've done is this so far:
>
> Create new file "simple_example.h" in "art/runtime":
>
>     #ifndef ART_RUNTIME_SIMPLE_H
>     #define ART_RUNTIME_SIMPLE_H
>     namespace simple {
>     extern void simple_print(int num);
>     }
>     #endif
>
> Where the `simple_print(int)` function is implemented as a Rust library.
>
> I then use the `simple_print()` function in some ART code by importing the
> header and using the function like: `simple::simple_print(10);`
>
> I then copy the `libsimple.so` prebuilt library into the respective
> "prebuilts/runtime/mainline/runtime/sdk/{os}/{arch}*/lib/*" directories.
> I've then edited two SOONG blueprint files:
>
> "art/runtime/Android.bp":
>
> @@ -485,6 +485,7 @@ libart_cc_defaults {
>          "libbase", // For common macros.
>          "liblog",
>          "liblz4",
> +        "libsimple",
>          "liblzma", // libelffile(d) dependency; must be repeated here
> since it's a static lib.
>          "libnativebridge",
>          "libnativeloader",
>
> (i.e. I've added the library to the "shared_libs" for
> "libart_cc_defaults")
>
> "prebuilts/runtime/mainline/runtime/sdk/Android.bp":
>
> @@ -1612,6 +1612,54 @@ cc_prebuilt_library_static {
>      },
>  }
>
> +cc_prebuilt_library_shared {
> +    name: "libsimple",
> +    prefer: true,
> +    visibility: ["//visibility:public"],
> +    apex_available: [
> +        "com.android.art",
> +        "com.android.art.debug",
> +    ],
> +    target: {
> +        host: {
> +            enabled: true,
> +        },
> +        android: {
> +            compile_multilib: "both",
> +        },
> +        android_arm64: {
> +            srcs: ["android/arm64/lib/libsimple.so"],
> +        },
> +        android_x86_64: {
> +            srcs: ["android/x86_64/lib/libsimple.so"],
> +        },
> +        android_arm: {
> +            srcs: ["android/arm/lib/libsimple.so"],
> +        },
> +        android_x86: {
> +            srcs: ["android/x86/lib/libsimple.so"],
> +        },
> +        linux_bionic: {
> +            compile_multilib: "64",
> +        },
> +        linux_bionic_x86_64: {
> +            enabled: true,
> +            srcs: ["linux_bionic/x86_64/lib/libsimple.so"],
> +        },
> +        linux_glibc_x86_64: {
> +            enabled: true,
> +            srcs: ["linux_glibc/x86_64/lib/libsimple.so"],
> +        },
> +        linux_glibc_x86: {
> +            enabled: true,
> +            srcs: ["linux_glibc/x86/lib/libsimple.so"],
> +        },
> +    },
> +    strip: {
> +        none: true,
> +    }
> +}
> +
>  sdk_snapshot {
>      name: "runtime-module-sdk@current",
>      visibility: ["//visibility:public"],
>
> However, building it gives me an error like: "module libart missing
> dependencies: libsimple{os:linux_glibc,arch:x86_64,link:shared}". Note I
> created the "linux_glibc" directory to
> "prebuilts/runtime/mainline/runtime/sdk/" myself which I though would have
> been a fix for the error, but unfortunately it did not work.
>
> Any help you can offer will be much appreciated. Thank you for your time.
>
> Sincerely,
> Kunal
>
> On Tuesday, November 15, 2022 at 9:28:25 PM UTC+11 Orion Hodson wrote:
>
>> Hi Kunal
>>
>> You can build ART for host with the master-art manifest using:
>>
>> $ cd $ANDROID_BUILD_TOP
>> $ . build/envsetup.sh
>> $ lunch silvermont-eng
>> $ art/tools/buildbot-build.sh --host
>>
>> You can check your changes don't break existing tests unexpectedly
>> running:
>>
>> $ art/test.py --host -r -g
>>
>> Good luck
>> Orion
>>
>>
>> On Thu, 3 Nov 2022 at 20:36, Kunal Sareen <[email protected]> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to build and run the Android Runtime (ART) standalone (i.e.
>>> natively) on a Linux (Ubuntu 22.04) system. I'm trying to do this to have a
>>> faster turn-around time for development (I'm planning on working on ART for
>>> a research project).
>>>
>>> My understanding is that I need to use the `silvermont-eng` target,
>>> which I set using `lunch`. However, if I try to build ART as an APEX
>>> package (as is mentioned in the ART build README), then the built
>>> executables expect the runtime linker to be at `/system/bin/linker` so fail
>>> to run natively on the Linux machine.
>>>
>>> Here's how I've built the above (I'm using the `master-art` manifest in
>>> order to only build ART):
>>> ```
>>> repo init -b master-art -u
>>> https://android.googlesource.com/platform/manifest
>>> source build/envsetup.sh
>>> export SOONG_ALLOW_MISSING_DEPENDENCIES=true
>>> lunch silvermont-eng
>>> TARGET_BUILD_APPS="com.android.art" TARGET_BUILD_UNBUNDLED=true m
>>> ```
>>>
>>> I presume the issues are related to building an APEX package for ART. Is
>>> there a way to not build an APEX package then?
>>>
>>> Any help you can offer will be much appreciated.
>>>
>>> Sincerely,
>>> Kunal
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the "Android
>>> Building" mailing list.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/android-building/04804340-d186-4ec7-87fb-8dde31f9381en%40googlegroups.com
>>> <https://groups.google.com/d/msgid/android-building/04804340-d186-4ec7-87fb-8dde31f9381en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/029c1cba-5fb2-4b0e-9fa3-a547954316cfn%40googlegroups.com
> <https://groups.google.com/d/msgid/android-building/029c1cba-5fb2-4b0e-9fa3-a547954316cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/CAAttue0Y1uX2f055EqpXxZP8XAj9%3DFexMvb%3DOebsFSsuJbVY_Q%40mail.gmail.com.

Reply via email to