[Mono-dev] [PATCH] Android Support [3/4]
jonpryor at vt.edu
Mon Apr 19 15:31:40 EDT 2010
On Mon, 2010-04-19 at 15:22 -0300, Rodrigo Kumpera wrote:
> On Mon, Apr 19, 2010 at 2:44 PM, Jonathan Pryor <jonpryor at vt.edu>
> + [AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], ,
> + [Define to 1 if you have /usr/include/malloc.h.])],,)
> What's the use for this? We check the header but then we don't use the
> new define.
That's because it's an old define, used in mono/utils/dlmalloc.c and
mono/utils/dlmalloc.h. I don't know why our configure doesn't set it,
but without this check compiling under the Android NDK results in a
build failure .
The primary issue appears to be system header files. mono-codeman.c
#includes <string.h>. Under glibc, <string.h> only #includes
<features.h> and <stddef.h>.
Under Android, however, <string.h> #includes <malloc.h> as well, and
<malloc.h> includes a definition for `struct mallinfo`, and since
mono-codeman.c also #includes "dlmalloc.h" this results in a duplicate
definition for `struct mallinfo`.
Different system headers, different results.
This also implies that my patch, as is, won't work under desktop Linux
(oops). Specifically, mono-codeman.c needs to #include <malloc.h>
before #including "dlmalloc.h".
 In file included from mono-codeman.c:16:dlmalloc.h: At top level:
dlmalloc.h:195: error: redefinition of 'struct mallinfo'
More information about the Mono-devel-list