facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.04k stars 536 forks source link

Build wangle encountered error: error: use of undeclared identifier 'malloc_usable_size' #65

Closed ustczxf closed 7 years ago

ustczxf commented 7 years ago

When I tried to build wangle, it reported: In file included from /project/opensource/source/wangle/wangle/../wangle/concurrent/ThreadPoolExecutor.h:19: In file included from /project/opensource/source/wangle/wangle/../wangle/deprecated/rx/Observable.h:20: /usr/local/include/folly/small_vector.h:619:14: error: use of undeclared identifier 'malloc_usable_size' return malloc_usablesize(u.pdata.heap_) / sizeof(value_type);

I've built "folly" successfully, did anyone encounter the same issue? Thanks!

mohnishkodnani commented 7 years ago

Yes I am getting the same issue. I was also able to compile folly without any issues. I am using MAC OS X 10.11.6 and gcc 6. This is happening after pulling the latest master branch after about few months on both folly and wangle.

/git/wangle/wangle/concurrent/ThreadPoolExecutor.cpp:68:58: required from here /usr/local/include/folly/small_vector.h:619:32: error: 'malloc_usable_size' was not declared in this scope return malloc_usablesize(u.pdata.heap_) / sizeof(value_type);


make[2]: **\* [CMakeFiles/wangle.dir/concurrent/ThreadPoolExecutor.cpp.o] Error 1
make[1]: **\* [CMakeFiles/wangle.dir/all] Error 2
make: **\* [all] Error 2
mohnishkodnani commented 7 years ago

It turns out it has something to do with jemalloc. when I checked the configure output of compiling folly it had checked and said malloc_usable_size yes but for malloc.h check it had said false. Then when I uninstalled jemalloc from my system , recompiled folly, it said malloc_usable_size as false and after this I could build wangle fine.

ustczxf commented 7 years ago

Thanks @mohnishkodnani , after I removed jemalloc, it works now.

Allen5 commented 7 years ago

It still not work after i removed jemalloc from my system(OSX 10.12).

YiqiuLiu commented 7 years ago

I am having problem with this too. Installed folly with homebrew, got back luck with small_vector.h.

anyflow commented 7 years ago

I got the same problem. No difference with removing jemalloc, installing folly by homebrew / compiling source in macOS 10.12.1.

howardzhang commented 7 years ago

I am getting the same issue. My machine is OS X 10.12. Any update?

anirudhvr commented 7 years ago

folly/portability/Malloc.cpp provides a defintion for malloc_usable_size for apple platforms. Can you check why that code is not being executed on your platform (e.g., put a #error "check") inside the APPLE guard.

howardzhang commented 7 years ago

@anirudhvr I was able to resolve this issue using @mohnishkodnani method.