How to fix missing stat() on iOS?


LLVM/Clang uses stat() function to get file info (/Unix/

error_code status(const Twine &Path, file_status &Result) {
SmallString<128> PathStorage;
StringRef P = Path.toNullTerminatedStringRef(PathStorage);

struct stat Status;
int StatRet = ::stat(P.begin(), &Status); // failure here
return fillStatus(StatRet, Status, Result);

but it fails to run on iOS simulator with error:

2014-07-07 16:55:14.138 LibClangUsage7Demo[74938:60b] started Detected
an attempt to call a symbol in system libraries that is not present on
the iPhone: stat$INODE64 called from function
_ZN4llvm3sys2fs6statusERKNS_5TwineERNS1_11file_statusE in image LibClangUsage7Demo.

For some reason stat() is said to be missing on iOS simulator though some people say they are able to use it in regular iOS apps.

How can i fix/workaround it?