[Buildroot] [PATCH] package/uclibc: add patch to fix reallocarray() definition

Julien Olivain ju.o at free.fr
Sun Apr 6 20:02:06 UTC 2025


On 03/04/2025 23:36, Thomas Petazzoni via buildroot wrote:
> uClibc-ng unconditionally exposes a reallocarray() prototype, but only
> provides the implementation when the malloc-standard implementation is
> selected in the configuration.
> 
> As noMMU configurations can't use malloc-standard, they use malloc or
> malloc-simple that don't provide reallocarray().
> 
> As a result of reallocarray() being missing, some packages such as
> util-linux provide their own replacement implementation... but its
> prototype clashes with the one provided by uClibc, causing build
> failures such as:
> 
> In file included from lib/color-names.c:7:
> ./include/c.h:586:21: error: static declaration of ‘reallocarray’ 
> follows non-static declaration
>   586 | static inline void *reallocarray(void *ptr, size_t nmemb, 
> size_t size)
>       |                     ^~~~~~~~~~~~
> In file included from ./include/c.h:16:
> /home/thomas/projets/buildroot/output/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/include/stdlib.h:898:14: 
> note: previous declaration of ‘reallocarray’ with type ‘void *(void *, 
> size_t,  size_t)’ {aka ‘void *(void *, unsigned int,  unsigned int)’}
>   898 | extern void *reallocarray (void *__ptr, size_t __m, size_t 
> __n);
>       |              ^~~~~~~~~~~~
> make[3]: *** [Makefile:12354: lib/libtcolors_la-color-names.lo] Error 1
> 
> This is addressed by a patch on uClibc, submitted upstream, which
> makes sure the prototype is only exposed when the implementation is
> provided.
> 
> Fixes:
> 
>   
> https://autobuild.buildroot.net/results/157aa82aa4cd57eacc4defe6cace16e464261e9a/ 
> (RISC-V noMMU)
>   
> https://autobuild.buildroot.net/results/ce1a24c1465b82686ae375ac688a553fb65df5ea/ 
> (ARM noMMU)
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>

Applied to master, thanks.


More information about the buildroot mailing list