2014-07-07 45 views
0

我編譯並鏈接了使用lib(libclang)的ios應用程序,該應用程序使用stat()而沒有錯誤。但我有運行時錯誤:stat()在ios模擬器中不可用?

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代碼引發錯誤的是(/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); 
} 

我怎麼能夠無需統計應用程序鏈接()在符號?我如何修復/漫步它?

PS。我可以看到stat由iOS的支持(模擬器): https://developer.apple.com/library/prerelease/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/stat.2.html

回答

0

問題是您爲OSX構建了libclang並將其鏈接到iOS可執行文件。您需要爲正確的平臺構建libclang。

stat當然在iOS上支持。