[Buildroot] [PATCH v2 07/11] package/flex: disable reallocarray

Romain Naour romain.naour at gmail.com
Sat Sep 2 22:23:40 UTC 2017


Thomas,

Le 02/09/2017 à 23:12, Thomas Petazzoni a écrit :
> Hello,
> 
> On Sat,  2 Sep 2017 22:54:19 +0200, Romain Naour wrote:
>> This doesn't compile with glibc 2.26 where reallocarray() as been introduced.
>>
>> Fixes:
>> stage1flex-misc.o: In function `allocate_array':
>> misc.c:(.text+0x38f): undefined reference to `reallocarray'
>> stage1flex-misc.o: In function `reallocate_array':
>> misc.c:(.text+0xc8a): undefined reference to `reallocarray'
>> collect2: error: ld returned 1 exit status
> 
> This commit log is a bit mysterious: if reallocarray() has been
> introduced in glibc 2.26, why isn't flex able to use it ?

It's a nasty issue, when reallocarray() is available for the target, flex will
build a small tool called stage1flex for the host (using _FOR_BUILD) but with
the config.h generated for the target.

My host doesn't have glibc 2.26, so reallocarray() is never defined while
building stage1flex:

misc.c:147:8: warning : implicit declaration of function « reallocarray »
[-Wimplicit-function-declaration]
  mem = reallocarray(NULL, (size_t) size, element_size);
        ^~~~~~~~~~~~
misc.c:147:6: warning : assignment makes pointer from integer without a cast
[-Wint-conversion]
  mem = reallocarray(NULL, (size_t) size, element_size);
      ^

I don't know how to fix this, except by disabling reallocarray() for the target...

Best regards,
Romain

> 
> Thomas
> 




More information about the buildroot mailing list