How to build 32/64-bit shared libs from 32/64-bit pre-built static libs in master AOSP arm64

3,496 views
Skip to first unread message

Casper Mok

unread,
Oct 24, 2014, 12:07:03 AM10/24/14
to android-...@googlegroups.com
Hi, 

I try to build 32/64-bit shared libraries from 32/64-bit static pre-built libraries in AOSP master under arm64-v8. 

I find several variables that I used in KitKat do not supporting 32/64-bit build, such as 
  • LOCAL_PREBUILT_MODULE_FILE
  • LOCAL_PREBUILT_LIBS
Indeed, all but LOCAL_PREBUILT_JNI_LIBS are not supporting 32/64-bit build. Further study finds that multi_prebuilt.mk does not support 32/64-bit builds. 

I am wondering if they are going to support in the near future or if there is a workaround now.

Cheers,
Casper


Casper Mok

unread,
Oct 31, 2014, 2:30:40 AM10/31/14
to android-...@googlegroups.com
I see no reply here. I give one example here - "LOCAL_PREBUILT_MODULE_FILE_$(TARGET_2ND_ARCH)" 

The necessary "TARGET_2ND_ARCH" for "LOCAL_PREBUILT_MODULE_FILE" is not supported in current AOSP master. Is there any workaround for this?

Cheers,
Casper
Android.mk

Ying Wang

unread,
Oct 31, 2014, 12:54:11 PM10/31/14
to Android Building
You can easily build it with $(BUILD_PREBUILT), using arch specific LOCAL_SRC_FILES:

include $(CLEAR_VARS)
LOCAL_MODULE_SUFFIX := .a
LOCAL_MODULE := my_lib
LOCAL_MODULE_CLASS := STATIC_LIBRARIES

LOCAL_SRC_FILES_arm := <path-to-the-arm-prebuilt>
LOCAL_SRC_FILES_arm64 := <path-to-the-arm64-prebuilt>
LOCAL_MODULE_TARGET_ARCHS := arm arm64
LOCAL_MULTILIB := both
include $(BUILD_PREBUILT)



--
--
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.

Ying Wang

unread,
Oct 31, 2014, 12:57:39 PM10/31/14
to Android Building
It should be LOCAL_MODULE_TARGET_ARCH (with no ending S).

Casper Mok

unread,
Nov 2, 2014, 9:49:14 PM11/2/14
to android-...@googlegroups.com
Ying Wang, 

Thank you. The suggestion on followings do work
  • LOCAL_SRC_FILES_arm & LOCAL_SRC_FILES_arm64
  • LOCAL_MODULE_TARGET_ARCH arm arm64
However, the 2nd party of this file is still not working. This involves linking 2 static libaries, my_a_lib and my_b_lib into a bigger library my_lib. It shows msg below.
"prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-ar: unable to copy file 'out/target/product/generic_arm64/obj/STATIC_LIBRARIES/my_lib_intermediates/my_lib.a'; reason: Permission denied"

These involve following variables. Can someone give suggestions here? Thank you.
  • LOCAL_WHOLE_STATIC_LIBRARIES
  • LOCAL_EXPORT_C_INCLUDE_DIRS
Cheers,
Casper

Ying Wang

unread,
Nov 3, 2014, 2:59:44 PM11/3/14
to Android Building
On Sun, Nov 2, 2014 at 6:49 PM, Casper Mok <caspe...@gmail.com> wrote:
Ying Wang, 

Thank you. The suggestion on followings do work
  • LOCAL_SRC_FILES_arm & LOCAL_SRC_FILES_arm64
  • LOCAL_MODULE_TARGET_ARCH arm arm64
However, the 2nd party of this file is still not working. This involves linking 2 static libaries, my_a_lib and my_b_lib into a bigger library my_lib. It shows msg below.
"prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-ar: unable to copy file 'out/target/product/generic_arm64/obj/STATIC_LIBRARIES/my_lib_intermediates/my_lib.a'; reason: Permission denied"
It doesn't seem to be a build system issue. Check the permission bits of the concerned files. 
Reply all
Reply to author
Forward
0 new messages