Hatena::Groupandroid

naoya_t@android RSSフィード

 Android入門記兼備忘録 since 2009.6.9
 | 

2009-07-04

Boehm GC 7.2 alpha2

15:46 | Boehm GC 7.2 alpha2 - naoya_t@android を含むブックマーク はてなブックマーク - Boehm GC 7.2 alpha2 - naoya_t@android

に、PLATFORM_ANDROIDという定数があるではないか!

2009-06-12 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidanski and George Talbot)

(diff95_cvs)

* include/private/gcconfig.h (PLATFORM_ANDROID): New macro

recognized (for Linux on ARM32 without glibc).

http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/

中をみたら、昨日自分でごにょごにょやってたのと同様(あるいは更に洗練された方法)のことが書かれている模様。

but

これを NDK build でも生かす方法が分からない!

LOCAL_CFLAGS-DPLATFORM_ANDROID=1 とか入れたぐらいじゃ駄目なんです

-DLINUXが立ってないから。しかし -DLINUXすると link.h が無いとか言われてアウト

Gauche-0.8.14/gc 以下をこれに置き換えたらOKかな?と思ったけれどお預け…

LINUXなしで、かつPLATFORM_ANDROID有りの場合にも何とかなるように書き換えたらうまく行った

--- gc-7.2alpha2-orig/include/private/gcconfig.h        2009-06-13 03:38:08.000000000 +0900
+++ gc-7.2alpha2/include/private/gcconfig.h     2009-07-04 16:31:08.000000000 +0900
@@ -1767,6 +1767,10 @@
 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
 #       endif
 #   endif
+#   ifdef PLATFORM_ANDROID
+#        define SEARCH_FOR_DATA_START
+#     undef NOSYS
+#   endif
 #   ifdef MSWINCE
 #     define OS_TYPE "MSWINCE"
 #     define DATAEND /* not needed */
@@ -2182,7 +2186,7 @@
 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
        --> inconsistent configuration
 # endif
-# if defined(GC_LINUX_THREADS) && !defined(LINUX)
+# if defined(GC_LINUX_THREADS) && !defined(LINUX) && !defined(PLATFORM_ANDROID)
        --> inconsistent configuration
 # endif
 # if defined(GC_NETBSD_THREADS) && !defined(NETBSD)

--- gc-7.2alpha2-orig/include/private/gc_priv.h	2009-06-09 14:19:48.000000000 +0900
+++ gc-7.2alpha2/include/private/gc_priv.h	2009-07-04 16:22:46.000000000 +0900
@@ -2003,7 +2003,7 @@
 /* were possible, and a couple of routines to facilitate	*/
 /* catching accesses to bad addresses when that's		*/
 /* possible/needed.						*/
-#if defined(UNIX_LIKE) || (defined(NEED_FIND_LIMIT) && defined(CYGWIN32))
+#if defined(UNIX_LIKE) || (defined(NEED_FIND_LIMIT) && defined(CYGWIN32)) || defined(PLATFORM_ANDROID)
 # include <setjmp.h>
 # if defined(SUNOS5SIGS) && !defined(FREEBSD)
 #  include <sys/siginfo.h>

Android.mkはこんな感じ

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := gc72
LOCAL_SRC_FILES := allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
        dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c malloc.c \
        mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c \
        os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
        specific.c stubborn.c typd_mlc.c backgraph.c \
        thread_local_alloc.c \
        pthread_support.c pthread_stop_world.c darwin_stop_world.c win32_threads.c \
        mach_dep.c

# Android.mk には -g とか -O2 とか書いてはいけないらしい (ソース: docs/ANDROID-MK.TXT)
LOCAL_CFLAGS := \
  -fexceptions -I$(LOCAL_PATH)/include -I$(LOCAL_PATH)/libatomic_ops/src \
  -DPLATFORM_ANDROID \
  -DPACKAGE_NAME=\"gc\" -DPACKAGE_TARNAME=\"gc\" -DPACKAGE_VERSION=\"7.2alpha2\" -DPACKAGE_STRING=\"gc\ 7.2alpha2\" -DPACKAGE_BUGREPORT=\"Hans.Boehm@hp.com\" -DGC_VERSION_MAJOR=7 -DGC_VERSION_MINOR=2 -DGC_ALPHA_VERSION=2 -DPACKAGE=\"gc\" -DVERSION=\"7.2alpha2\" -DGC_LINUX_THREADS=1 -D_REENTRANT=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DNO_EXECUTE_PERMISSION=1 -DALL_INTERIOR_POINTERS=1 -DGC_GCJ_SUPPORT=1 -DJAVA_FINALIZATION=1 -DATOMIC_UNCOLLECTABLE=1


LOCAL_LDLIBS := -Lbuild/platforms/android-1.5/arch-arm/usr/lib -lc -ldl

include $(BUILD_SHARED_LIBRARY)

ビルド:

android-ndk-1.5_r1> make APP=gc
Android NDK: Building for application 'gc'    
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/allchblk.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/alloc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/blacklst.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/checksums.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/dbg_mlc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/dyn_load.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/finalize.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/gc_dlopen.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/gcj_mlc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/headers.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/malloc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/mallocx.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/mark.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/mark_rts.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/misc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/new_hblk.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/obj_map.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/os_dep.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/pcr_interface.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/ptr_chck.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/real_malloc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/reclaim.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/specific.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/stubborn.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/typd_mlc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/backgraph.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/thread_local_alloc.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/pthread_support.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/pthread_stop_world.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/darwin_stop_world.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/win32_threads.c
Compile thumb  : gc72 <= sources/my/gc-7.2alpha2/mach_dep.c
SharedLibrary  : libgc72.so
Install        : libgc72.so => apps/gc/project/libs/armeabi

これで出来てるのかな…(続く

Marcos DioneMarcos Dione2009/12/08 20:15can you please translate this to english? I think I'm having similar problems compiling gc-7.2alpha4 against android-1.5 and unluckily automatic translators don't give anything that makes sense... thanks in advance.

Ivan MaidasnkiIvan Maidasnki2009/12/11 19:35I've recently (2009-12-08) chnaged the Android-specific code (in BoehmGC), so it's better to fetch the latest code from BDWGC CVS.
Compilation notes (for Android):
1. use "-D PLATFORM_ANDROID";
2. either use "-D IGNORE_DYNAMIC_LOADING" (if you don't need the registration of dynamic libraries data roots) or "-I bionic/linker".

AmberleeAmberlee2012/02/15 07:29There are no words to descrbie how bodacious this is.

oupxwmszoaoupxwmszoa2012/02/16 17:40GZPcEF <a href="http://lnejinfuubaq.com/">lnejinfuubaq</a>

mufjzolunmufjzolun2012/02/17 00:46vXT5re , [url=http://yoaycjvjswfg.com/]yoaycjvjswfg[/url], [link=http://dbznrhgzcwkc.com/]dbznrhgzcwkc[/link], http://tenbbujzyeun.com/

ditbxdnvemditbxdnvem2012/02/17 20:31sZWvZF <a href="http://jsnwrtxxcvkw.com/">jsnwrtxxcvkw</a>

LukFulkLukFulk2018/02/06 20:20Need Perscription Amoxicillin Cialis Dauererektion 247 Overnight Pharmacy Canadian [url=http://cial20mg.com]cialis online[/url] Prednisone From Mexico Effetti Collaterali Cialis 5 Mg What Is Provera Used To Treat

トラックバック - http://android.g.hatena.ne.jp/n4_t/20090704
 |