GrapheneOS / hardened_malloc

Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.
https://grapheneos.org/
MIT License
1.3k stars 97 forks source link

Build Error #216

Closed nikhilspatil closed 1 year ago

nikhilspatil commented 1 year ago

Hi

I cloned the repo, and set the GCC version to 13.1.0 I did make, and hitting the below error

[12:05 pm] Atharva Bhanage

bin/gcc -std=c11 -pipe -O3 -flto -fPIC -fvisibility=hidden -fPIC -fstack-clash-protection -fcf-protection -fstack-protector-strong -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Wundef -Werror -march=native -Wmissing-prototypes -Wstrict-prototypes -Wno-error -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=256 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -DCONFIG_SELF_INIT=true -c -o out/h_malloc.o h_malloc.c

In file included from h_malloc.c:15:

include/h_malloc.h:26:21: error: return type is an incomplete type

26 | #define h_mallinfo2 mallinfo2

  |                     ^~~~~~~~~

h_malloc.c:1818:25: note: in expansion of macro 'h_mallinfo2'

1818 | EXPORT struct mallinfo2 h_mallinfo2(void) {

  |                         ^~~~~~~~~~~

include/h_malloc.h:26:21: warning: no previous prototype for 'mallinfo2' [-Wmissing-prototypes]

26 | #define h_mallinfo2 mallinfo2

  |                     ^~~~~~~~~

h_malloc.c:1818:25: note: in expansion of macro 'h_mallinfo2'

1818 | EXPORT struct mallinfo2 h_mallinfo2(void) {

  |                         ^~~~~~~~~~~

h_malloc.c: In function 'mallinfo2':

h_malloc.c:1819:12: error: variable 'info' has initializer but incomplete type

1819 | struct mallinfo2 info = {0};

  |            ^~~~~~~~~

h_malloc.c:1819:30: warning: excess elements in struct initializer

1819 | struct mallinfo2 info = {0};

  |                              ^

h_malloc.c:1819:30: note: (near initialization for 'info')

h_malloc.c:1819:22: error: storage size of 'info' isn't known

1819 | struct mallinfo2 info = {0};

  |                      ^~~~

h_malloc.c:1858:12: warning: 'return' with a value, in function returning void [-Wreturn-type]

1858 | return info;

  |            ^~~~

In file included from h_malloc.c:15:

include/h_malloc.h:26:21: note: declared here

26 | #define h_mallinfo2 mallinfo2

  |                     ^~~~~~~~~

h_malloc.c:1818:25: note: in expansion of macro 'h_mallinfo2'

1818 | EXPORT struct mallinfo2 h_mallinfo2(void) {

  |                         ^~~~~~~~~~~

h_malloc.c:1819:22: warning: unused variable 'info' [-Wunused-variable]

1819 | struct mallinfo2 info = {0};

  |                      ^~~~

Could you please help me debug this issue.

thestinger commented 1 year ago

It looks like your glibc is too old.