stat() unavailable in ios simulator?

拈花ヽ惹草 提交于 2019-12-31 05:16:12

问题


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


回答1:


I was said stat is not supported on iOS.




回答2:


The issue is that you built libclang for OSX and linked it into an iOS executable. You need to build libclang for the correct platform.

stat certainly is supported on iOS.



来源:https://stackoverflow.com/questions/24609034/stat-unavailable-in-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!