Android issues

Mike Hommey mh+jemalloc at glandium.org
Thu Mar 15 23:22:47 PDT 2012


On Thu, Mar 15, 2012 at 05:13:58PM -0700, Jason Evans wrote:
> On Mar 15, 2012, at 12:58 PM, Mike Hommey wrote:
> > I'm trying to get jemalloc built for Android, and here is a short list
> > of things that go wrong:
> > - pthread_create is not defined in libpthread, but in libc, which makes
> >  the configure.ac test fail.
> 
> Interesting.  A workaround for this should be pretty straightforward (on my todo list now).
> 
> > - The AC_RUN_IFELSE test for STATIC_PAGE_SHIFT fails because it requires
> >  not to be cross-compiling, which makes configure.ac hard-fail.
> 
> Andreas Vinsander cross-compiled for SH4 by providing sh4.cache to configure:
> 
> 	http://jemalloc.net/mailman/jemalloc-discuss/2011-April/000018.html
> 
> Perhaps something similar will work for Android.

Yeah, what I did was to pass je_cv_static_page_shift=12 to configure.
That works, too.

> > - Android system headers don't provide sys/sysctl.h. But it seems it's
> >  not used anyways, so removing the include worked for me (and worked on
> >  plain Linux too)
> 
> I think this was a holdover from using sysctl to get the number of CPUs.  I just removed it on the dev branch.
> 
> > - There are no atomic ops for arm, but the __sync_* ones work. Sadly,
> >  the compiler doesn't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
> 
> Ouch.  Maybe "CPPFLAGS=-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 configure …" will be an adequate workaround.

Alternatively, adding __arm__ to the other place where the __sync_*
functions are used works too. (where currently there is sha4 and mips)

Mike



More information about the jemalloc-discuss mailing list