Just thought I would close the loop on this issue in case it helps someone
else...

I found the solution looking over the Cherokee cookbook entries on
cross-compiling and embedding (should have looked here first!).  Since
autoconf is tripped up checking for libc malloc on cross-compiles (see
http://wiki.buici.com/wiki/Autoconf_and_RPL_MALLOC), you simply tell it to
ignore via these two lines prior to calling configure; assuming you know
your compiler is compliant:

export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes

FWIW, someone might want to check util.c/h.  The rpl_realloc() definition
appears to be missing and the conditional compile doesn't look right to me.
I think the code below will work.  There also appears to be a step missing
to link util.o with main.o, but I couldn't figure that out.  Its not
terribly important given you can just ignore the check but I thought I'd
mention it.  If I'm off-base on this, apologies in advance.

/*
 *  util.h
 */
#if HAVE_MALLOC==0
void *rpl_malloc (size_t n);
#endif
#if HAVE_REALLOC==0
void *rpl_realloc (void *p, size_t size);
#endif

/*
 * util.c
 */
#if HAVE_MALLOC==0
void *
rpl_malloc (size_t n)
{
    if (unlikely (n == 0))
        n = 1;

    return malloc (n);
}
#endif

#if HAVE_REALLOC==0
void *rpl_realloc(void *p, size_t size)
{
    if (size == 0)
        ++size;

    return realloc(p, size);
}
#endif


On Mon, May 11, 2009 at 1:25 PM, Rick Walsh <[email protected]> wrote:

> Hi,
>
> I'm trying to compile 0.99.14 for the PowerPC under LTIB (Freescale
> cross-compile framework).  I'm getting the following error(s):
>
>
> *** Warning: Linking the shared library libplugin_phpcgi.la against the
> loadable module
> *** libplugin_file.so is not portable!
> (cd .libs && rm -f libplugin_ip_hash.la && ln -s ../libplugin_ip_hash.la
> libplugin_ip_hash.la)
> main.o: In function `do_spawn':
> /home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:327:
> undefined reference to `rpl_malloc'
> /home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:336:
> undefined reference to `rpl_malloc'
> main.o: In function `pid_file_clean':
> /home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:273:
> undefined reference to `rpl_malloc'
> main.o: In function `figure_worker_path':
> /home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:89:
> undefined reference to `rpl_malloc'
> /home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:108:
> undefined reference to `rpl_malloc'
> main.o:/home/rwalsh05/LTIB/cmn100/rpm/BUILD/cherokee-0.99.14/cherokee/main.c:116:
> more undefined references to `rpl_malloc' follow
> collect2: ld returned 1 exit status
> make[2]: *** [cherokee] Error 1
> make[2]: *** Waiting for unfinished jobs....
>
>
> I found the following in my config.log file, so I'm wondering how
> rpl_malloc() gets defined from util.c/h
>
> | #define HAVE_MALLOC 0
> | #define malloc rpl_malloc
>
>
> I'm going to ask the cross-compiler crowd why it would fail that test but,
> is not having the libc malloc/realloc a showstopper?  Any tips are
> appreciated.
>
>
> --
> Thanks,
> Rick Walsh
> [email protected]
>



-- 
Regards,
Rick Walsh
[email protected]
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to