Redex: Malloc.cpp fails to compile: unknown type name 'size_t'

Created on 13 Apr 2016  路  6Comments  路  Source: facebook/redex

~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F1713

~ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Failure message:
libtool: compile: g++ -DHAVE_CONFIG_H -I./.. -pthread -I/usr/local/include -std=gnu++0x -g -O2 -MT portability/Malloc.lo -MD -MP -MF portability/.deps/Malloc.Tpo -c portability/Malloc.cpp -fno-common -DPIC -o portability/.libs/Malloc.o
In file included from portability/Malloc.cpp:17:
./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t'
extern "C" size_t malloc_usable_size(void* ptr);
^
1 error generated.
make[4]: ** [portability/Malloc.lo] Error 1
make[3]: *
* [all-recursive] Error 1
make[2]: ** [all] Error 2
make[1]: *
* [all-recursive] Error 1
make: *** [all] Error 2

Most helpful comment

I added #include <stddef.h> to /third_party/folly/folly/portability/Malloc.h; seems to do the trick. I suppose one ought to fix that in Folly itself, and not here.

All 6 comments

I added #include <stddef.h> to /third_party/folly/folly/portability/Malloc.h; seems to do the trick. I suppose one ought to fix that in Folly itself, and not here.

yep. just noticed an issue was filed here: https://github.com/facebook/folly/issues/385

I added #include to /third_party/folly/folly/portability/Malloc.h

This did not work for me. I still get

In file included from portability/Malloc.cpp:17:
./../folly/portability/Malloc.h:28:12: error: unknown type name 'size_t'
extern "C" size_t malloc_usable_size(void* ptr);
           ^

ingConverter::DtoaMode, unsigned int) in redex_all-SingleImplAnalyze.o
...
"double_conversion::StringToDoubleConverter::StringToIeee(char const_, int, int_, bool) const", referenced from:
std::__1::enable_ifstd::is_floating_point::type folly::to(folly::Range_) in libfolly.a(json.o)
std::__1::enable_ifstd::is_floating_point::type folly::to(folly::Range_) in libfolly.a(dynamic.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: _* [redex-all] Error 1
make[1]: *
* [all-recursive] Error 1
make: *** [all] Error 2

I can confirm this is fixed on latest master

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erdemolkun picture erdemolkun  路  5Comments

amiton picture amiton  路  5Comments

hljwang3874149 picture hljwang3874149  路  4Comments

VenomVendor picture VenomVendor  路  7Comments

perphyyoung picture perphyyoung  路  9Comments