The build fails due to two calls to mallopt() in appletlib.c. "libbb/lib.a(appletlib.o): In function `main': appletlib.c:(.text.main+0x20): undefined reference to `mallopt' appletlib.c:(.text.main+0x3c): undefined reference to `mallopt' collect2: ld returned 1 exit status"
$ grep MALLOC uClibc/.config
Note that mallopt is only implemented for MALLOC_STANDARD and i guess you're trying to use MALLOC_SIMPLE. If this is correct, then either wrap the calls to mallopt with #if (defined __UCLIBC__ && defined __MALLOC_STANDARD__) || !defined __UCLIBC__ or switch to MALLOC_STANDARD.
(In reply to comment #1) > $ grep MALLOC uClibc/.config > $ grep MALLOC uClibc/.config # CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set CONFIG_MIPS_CPMAC_INIT_BUF_MALLOC=y # MALLOC_930716 is not set MALLOC=y # UCLIBC_MALLOC_DEBUGGING is not set
Well, the code is: #ifdef M_TRIM_THRESHOLD /* M_TRIM_THRESHOLD is the maximum amount of freed top-most memory * to keep before releasing to the OS * Default is way too big: 256k */ mallopt(M_TRIM_THRESHOLD, 2 * PAGE_SIZE); #endif does uclibc really defines M_TRIM_THRESHOLD if it does not support it? Which version of uclibc does that?
(In reply to comment #4) [...] > does uclibc really defines M_TRIM_THRESHOLD if it does not support it? Yes, it is defined in a header: $ grep -r M_TRIM_THRESHOLD uClibc/* uClibc/include/malloc.h:#define M_TRIM_THRESHOLD -1 > Which version of uclibc does that? uClibc 0.9.19, for an embedded platform (mipsel). It seems to be a uClibc problem: # define __MALLOC_P(args) args __THROW ... extern int mallopt __MALLOC_P ((int __param, int __val)); ...
Nope, it's inside #ifdef: #ifdef __MALLOC_STANDARD__ ... /* mallopt options that actually do something */ #define M_TRIM_THRESHOLD -1 #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 #define M_CHECK_ACTION -5 #define M_PERTURB -6 /* General SVID/XPG interface to tunable parameters. */ extern int mallopt __MALLOC_P ((int __param, int __val)); #endif /* __MALLOC_STANDARD__ */ uclibc 0.9.19?? That's ten versions older than most recent uclibc release, it's seven years old.
(In reply to comment #6) > Nope, it's inside #ifdef: > > #ifdef __MALLOC_STANDARD__ Unfortunately, not in our version (TI AR7 + MontaVista Linux 2.4.17). [...] > uclibc 0.9.19?? That's ten versions older than most recent uclibc release, it's > seven years old. Sadly so. This is code for firmwares for ADSL modem/routers, and it is not easily upgraded. I'll just add the #ifdef myself. Thanks.
i think the answer is fix your uClibc