ios - 截断的胖文件链接器错误

标签 ios xcode linker-errors

虽然我熟悉使用 Objective-C 进行开发,但在错误解释方面我仍然认为自己有点笨拙。我正在处理其他人也在处理的工作申请。我相信我们可能有不同版本的 Xcode,一个开发人员有一台 PC(其他人和我有一台 MacBook)。我正在使用 Xcode 4.5.1。

问题

我收到以下Apple Mach-O 链接器错误:

ld: truncated fat file. Slice from 68 to 2783300 is past end of file with length 135 for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

完整错误如下(路径重命名):

Ld build/Debug-iphonesimulator/MyApp.app/MyApp normal i386 cd /Users/me/Documents/MyApp/trunk setenv IPHONEOS_DEPLOYMENT_TARGET 5.1 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator -F/Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator -F/Users/me/Documents/MyApp/trunk -filelist /Users/me/Documents/MyApp/trunk/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -lsqlite3.0 -v -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -framework MobileCoreServices -weak_framework Accounts -weak_framework AdSupport -weak_framework Social -framework CoreBluetooth -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework FacebookSDK -o /Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator/MyApp.app/MyApp

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) Target: i386-apple-darwin11.4.2 Thread model: posix "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch i386 -ios_simulator_version_min 5.1.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -o /Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator/MyApp.app/MyApp -lcrt1.o -L/Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator -filelist /Users/me/Documents/MyApp/trunk/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -objc_abi_version 2 -lsqlite3.0 -no_implicit_dylibs -framework MobileCoreServices -weak_framework Accounts -weak_framework AdSupport -weak_framework Social -framework CoreBluetooth -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework FacebookSDK -force_load /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a -framework Foundation -lobjc -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.ios.a -F/Users/me/Documents/MyApp/trunk/build/Debug-iphonesimulator -F/Users/me/MyApp/trunk ld: truncated fat file. Slice from 68 to 2783300 is past end of file with length 135 for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我发现几乎没有关于此错误的文档。有什么问题?我该如何解决这样的错误?

最佳答案

我在某处读到这个答案,

文件和文件夹的符号链接(symbolic link)(在您的情况下是某些框架)在从 MAC-OS/X 移动到 Windows 时会变成胖文件。因此,每当我们将项目框架从您的 MAC 复制粘贴/ checkout 到 Windows 时,反之亦然,它会发生变化,文件会根据符号链接(symbolic link)进行修改。

所以您可以做的只是检查您的项目文件并单独替换框架(请注意您要替换的框架应该是新下载的或从 MAC 而非 WINDOWS 的某个地方复制)。

希望这对某人有帮助!

关于ios - 截断的胖文件链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14861683/

相关文章:

ios - 从不同的文件更新 TableView - 无法不带参数调用 'reloadData'

ios - Swift-NIO 安全的 websocket 服务器

ios - Appledoc 和自定义链接说明

Xcode 查找调用者函数

iphone - PNG 质量在 iPhone 上看起来很糟糕

ios - iOS将自定义API公开到WKWebView

javascript - 从后台切换回Safari时如何在iOS webapp中检测?

visual-studio-2010 - 指定的文件是无法识别或不受支持的二进制格式

c++ - 将 HDF5 库链接到 Visual C++ DLL 项目 : unresolved external symbol __imp__*

c++ - 更改 Qt 项目构建目录时出现大量链接器错误