Adding sysroot/usr/include

244 views
Skip to first unread message

Ashiq Shyam

unread,
May 22, 2024, 12:04:57 PMMay 22
to Android Building
How do I add sysroot/usr/include/android/ that is prebuilts/ndk/ to an android.bp that is in external/Helloworld ?

I tried adding it in the android.bp of my external/Helloworld/Android.bp as follows : 

cc_library_static {
    name: "hello",

    include_dirs: [
    "../../../prebuilts/ndk/android-ndk-r21b/sysroot/usr/include"
    ],
     
    srcs: [ "foo.c"
    ],

    host_ldlibs: [
        "-L" + "../../../prebuilts/ndk/android-ndk-r21b/sysroot" + "/usr/lib",
    ],

    cflags: [
       "foo" 
    ],

    static_libs: ["foo"],
    vendor: true,

}

However i receive the error that :

error: external/dab/MTK/Android.bp:117:1: module "hello" variant "android_vendor.34_arm64_armv8-a_cortex-a72_static": Path is outside directory: ../../../prebuilts/ndk/android-ndk-r21b/sysroot/usr/include


enh

unread,
May 22, 2024, 12:09:43 PMMay 22
to android-...@googlegroups.com
why are you trying to do that? soong will automatically give you the
right sysroot when it calls clang.
> --
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/6155fcdf-8fdf-4173-856e-16ebb0e57078n%40googlegroups.com.

Dan Willemsen

unread,
May 22, 2024, 12:12:25 PMMay 22
to android-...@googlegroups.com
You may want to use `sdk_version: "current"`, `sdk_version: "31"`, etc if you need it to be built against something similar to the NDK for some reason. But like Elliott said, after that it's all automatic.

- Dan

Reply all
Reply to author
Forward
0 new messages