【发布时间】:2014-08-27 20:14:41
【问题描述】:
我已经编译并链接了使用 stat() 且没有错误的 lib (libclang) 的 ios 应用程序。但我遇到了运行时错误:
2014-07-07 16:55:14.138 LibClangUsage7Demo[74938:60b] 开始检测 尝试调用系统库中不存在的符号 iPhone:从函数调用的 stat$INODE64 _ZN4llvm3sys2fs6statusERKNS_5TwineERNS1_11file_statusE 在图像 LibClangUsage7Demo 中。
引发错误的 LLVM 代码是 (/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);
}
我如何能够在没有 stat() 符号的情况下链接应用程序?我该如何修复/绕过它?
PS。我可以看到 iOS(模拟器?)支持stat:
https://developer.apple.com/library/prerelease/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/stat.2.html
【问题讨论】: