[cfe-dev] How to fix missing stat() on iOS?

Anton Smirnov dev at antonsmirnov.name
Tue Jul 22 20:19:00 PDT 2014


Hi.

LLVM/Clang uses `stat()` function to get file info (/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);
    }

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][1] on iOS simulator though
some people say they are able to use it in regular iOS apps.

How can i fix/workaround it?


  [1]:
http://stackoverflow.com/questions/24609034/stat-unavailable-in-ios-simulator
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140723/9343c7f4/attachment.html>


More information about the cfe-dev mailing list