FAQ

[android-ndk] How do I build a fat binary with a standalone toolchain?

Wil Hadden
May 1, 2012 at 3:33 pm
I have gone down the route of using the standalone NDK toolchain to
compile code for android and it works the best.

I can happily create builds for arm7, arm5 and presumably x86 but
could someone explain or point me to a description of how to create a
fat binary using a standalone toolchain?

Thanks
Wil

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-ndk@googlegroups.com.
To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
reply

Search Discussions

7 responses

  • Chris Stratton at May 1, 2012 at 7:20 pm

    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • Wil Hadden at May 1, 2012 at 8:13 pm
    Yeah, sorry for the crappy name, it's something I picked up from my googling research. So do just need to compile a separate so for each CPU and copy it to the usual libs directory and, in my case, Eclipse will do the rest?

    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/1Qk1VSDcPD4J.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • Wil Hadden at May 13, 2012 at 10:48 pm

    On Tuesday, 1 May 2012 20:20:53 UTC+1, Chris Stratton wrote:
    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    Sorry to resurrect this but I am doing something wrong!

    I should say that I am using a standalone toolchain so I need to do
    everything manually. I can create separate so files for every platform I
    want to support, and obviously I can copy them to libs so they get picked
    up by the packager. My problem is that when I go to load them with
    System.loadLibrary I need to supply a specific library name.

    Can anyone tell me what I am doing wrong?

    Thanks
    Wil

    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/UHnv3pSuTzcJ.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • David Turner at May 14, 2012 at 6:32 am

    On Mon, May 14, 2012 at 12:48 AM, Wil Hadden wrote:
    On Tuesday, 1 May 2012 20:20:53 UTC+1, Chris Stratton wrote:
    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    Sorry to resurrect this but I am doing something wrong!

    I should say that I am using a standalone toolchain so I need to do
    everything manually. I can create separate so files for every platform I
    want to support, and obviously I can copy them to libs so they get picked
    up by the packager. My problem is that when I go to load them with
    System.loadLibrary I need to supply a specific library name.

    Can anyone tell me what I am doing wrong?
    All libraries should have the same name, but be placed in different
    ABI-specific directories, as in:

    libs/armeabi/libfoo.so
    libs/armeabi-v7a/libfoo.so
    libs/x86/libfoo.so

    The PackageManager will pick up the best library for your device at install
    time (from the .apk) and copy it to $DATA_DIR/lib/libfoo.so

    All you need to do in Java is System.loadLibrary("foo")

    For more details on how this works, read $NDK/docs/CPU-ARCH-ABIS.html, it
    has a section named "CPU ABI Management on the Android platform".


    Thanks
    Wil

    --
    You received this message because you are subscribed to the Google Groups
    "android-ndk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/android-ndk/-/UHnv3pSuTzcJ.

    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • Wil Hadden at May 14, 2012 at 8:29 am
    Thanks David,

    Very concise answer!

    Wil
    On 14 May 2012 07:32, David Turner wrote:


    On Mon, May 14, 2012 at 12:48 AM, Wil Hadden wrote:
    On Tuesday, 1 May 2012 20:20:53 UTC+1, Chris Stratton wrote:
    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    Sorry to resurrect this but I am doing something wrong!

    I should say that I am using a standalone toolchain so I need to do
    everything manually. I can create separate so files for every platform I
    want to support, and obviously I can copy them to libs so they get picked
    up by the packager. My problem is that when I go to load them with
    System.loadLibrary I need to supply a specific library name.

    Can anyone tell me what I am doing wrong?
    All libraries should have the same name, but be placed in different
    ABI-specific directories, as in:

    libs/armeabi/libfoo.so
    libs/armeabi-v7a/libfoo.so
    libs/x86/libfoo.so

    The PackageManager will pick up the best library for your device at
    install time (from the .apk) and copy it to $DATA_DIR/lib/libfoo.so

    All you need to do in Java is System.loadLibrary("foo")

    For more details on how this works, read $NDK/docs/CPU-ARCH-ABIS.html, it
    has a section named "CPU ABI Management on the Android platform".


    Thanks
    Wil

    --
    You received this message because you are subscribed to the Google Groups
    "android-ndk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/android-ndk/-/UHnv3pSuTzcJ.

    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups
    "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • Oyin Oluwatimi at Jul 20, 2012 at 7:08 am
    Hey,

    Do you use the toolchain to create custom armeabi-v7a binary? I want to
    edit/add security based functions to armeabi-v7a.

    Thanks
    Damola
    On Monday, May 14, 2012 5:29:20 PM UTC+9, Wil Hadden wrote:

    Thanks David,

    Very concise answer!

    Wil
    On 14 May 2012 07:32, David Turner wrote:


    On Mon, May 14, 2012 at 12:48 AM, Wil Hadden wrote:
    On Tuesday, 1 May 2012 20:20:53 UTC+1, Chris Stratton wrote:
    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    Sorry to resurrect this but I am doing something wrong!

    I should say that I am using a standalone toolchain so I need to do
    everything manually. I can create separate so files for every platform I
    want to support, and obviously I can copy them to libs so they get picked
    up by the packager. My problem is that when I go to load them with
    System.loadLibrary I need to supply a specific library name.

    Can anyone tell me what I am doing wrong?
    All libraries should have the same name, but be placed in different
    ABI-specific directories, as in:

    libs/armeabi/libfoo.so
    libs/armeabi-v7a/libfoo.so
    libs/x86/libfoo.so

    The PackageManager will pick up the best library for your device at
    install time (from the .apk) and copy it to $DATA_DIR/lib/libfoo.so

    All you need to do in Java is System.loadLibrary("foo")

    For more details on how this works, read $NDK/docs/CPU-ARCH-ABIS.html, it
    has a section named "CPU ABI Management on the Android platform".


    Thanks
    Wil

    --
    You received this message because you are subscribed to the Google
    Groups "android-ndk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/android-ndk/-/UHnv3pSuTzcJ.

    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups
    "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/7-1W-bvddboJ.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
  • Wil Hadden at Jul 23, 2012 at 9:42 am
    I do , the document docs\STANDALONE-TOOLCHAIN.html in the ndk tells you how
    to use the toolchain.



    Wil
    On 20 July 2012 08:08, Oyin Oluwatimi wrote:

    Hey,

    Do you use the toolchain to create custom armeabi-v7a binary? I want to
    edit/add security based functions to armeabi-v7a.

    Thanks
    Damola

    On Monday, May 14, 2012 5:29:20 PM UTC+9, Wil Hadden wrote:

    Thanks David,

    Very concise answer!

    Wil
    On 14 May 2012 07:32, David Turner wrote:


    On Mon, May 14, 2012 at 12:48 AM, Wil Hadden wrote:
    On Tuesday, 1 May 2012 20:20:53 UTC+1, Chris Stratton wrote:
    On May 1, 11:33 am, Wil Hadden wrote:
    I can happily create builds for arm7, arm5 and presumably x86 but
    could someone explain or point me to a description of how to create a
    fat binary using a standalone toolchain?
    AFAIK 'fat binary' is a bit of misnomer on Android - the normal ndk
    toolchain creates one distinct .so per ABI listed in the Android.mk,
    and copies them all to where the packager will combine them in a
    single APK so that the device can install whichever is appropriate.
    The only thing that is really "fat" is the apk.

    Sorry to resurrect this but I am doing something wrong!

    I should say that I am using a standalone toolchain so I need to do
    everything manually. I can create separate so files for every platform I
    want to support, and obviously I can copy them to libs so they get picked
    up by the packager. My problem is that when I go to load them with
    System.loadLibrary I need to supply a specific library name.

    Can anyone tell me what I am doing wrong?
    All libraries should have the same name, but be placed in different
    ABI-specific directories, as in:

    libs/armeabi/libfoo.so
    libs/armeabi-v7a/libfoo.so
    libs/x86/libfoo.so

    The PackageManager will pick up the best library for your device at
    install time (from the .apk) and copy it to $DATA_DIR/lib/libfoo.so

    All you need to do in Java is System.loadLibrary("foo")

    For more details on how this works, read $NDK/docs/CPU-ARCH-ABIS.html,
    it has a section named "CPU ABI Management on the Android platform".


    Thanks
    Wil

    --
    You received this message because you are subscribed to the Google
    Groups "android-ndk" group.
    To view this discussion on the web visit https://groups.google.com/d/**
    msg/android-ndk/-/UHnv3pSuTzcJ<https://groups.google.com/d/msg/android-ndk/-/UHnv3pSuTzcJ>
    **.

    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@*
    *googlegroups.com <android-ndk%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/android-ndk?hl=en<http://groups.google.com/group/android-ndk?hl=en>
    .
    --
    You received this message because you are subscribed to the Google
    Groups "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@**
    googlegroups.com <android-ndk%2Bunsubscribe@googlegroups.com>.
    For more options, visit this group at http://groups.google.com/**
    group/android-ndk?hl=en<http://groups.google.com/group/android-ndk?hl=en>
    .
    --
    You received this message because you are subscribed to the Google Groups
    "android-ndk" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/android-ndk/-/7-1W-bvddboJ.

    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to
    android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/android-ndk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "android-ndk" group.
    To post to this group, send email to android-ndk@googlegroups.com.
    To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post