Search code examples
iosxcodeclangllvmstat

stat() unavailable in ios simulator?


I've compiled and linked ios app that uses lib (libclang) that uses stat() with no errors. But i'm having runtime 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.

LLVM code which raises error is (/Unix/Path.inc):

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);
}

How was i able to link the app without having stat() in symbols? How can i fix/walk-around it?

PS. I can see stat is supported by iOS (Simulator?): https://developer.apple.com/library/prerelease/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/stat.2.html


Solution

  • I was said stat is not supported on iOS.