diff --git a/CMakeLists.txt b/CMakeLists.txt index 61303345..508934dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,10 +146,12 @@ endif() if(WIN32) list(APPEND mi_libraries psapi shell32 user32 bcrypt) else() - list(APPEND mi_libraries pthread) - find_library(LIBRT rt) - if(LIBRT) - list(APPEND mi_libraries ${LIBRT}) + if(NOT ${CC} MATCHES "android") + list(APPEND mi_libraries pthread) + find_library(LIBRT rt) + if(LIBRT) + list(APPEND mi_libraries ${LIBRT}) + endif() endif() endif() diff --git a/src/alloc-override.c b/src/alloc-override.c index c0e7bc2b..569e60ef 100644 --- a/src/alloc-override.c +++ b/src/alloc-override.c @@ -165,7 +165,11 @@ extern "C" { void* reallocf(void* p, size_t newsize) MI_FORWARD2(mi_reallocf,p,newsize); size_t malloc_size(void* p) MI_FORWARD1(mi_usable_size,p); +#if !defined(__ANDROID__) size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p); +#else +size_t malloc_usable_size(const void *p) MI_FORWARD1(mi_usable_size,p); +#endif void cfree(void* p) MI_FORWARD0(mi_free, p); // no forwarding here due to aliasing/name mangling issues