Xcode 4.2开发人员预览版中的链接器错误

yar*_*nov 16 iphone deployment xcode target ios

d /Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator/Goozzy.app/Goozzy normal i386
cd /Users/yariksmirnov/Desktop/Goozy/branches/new
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator -F/Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator -filelist /Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Intermediates/Goozzy.build/Debug-iphonesimulator/Goozzy.build/Objects-normal/i386/Goozzy.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -framework CoreData -lz.1.2.3 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator/Goozzy.app/Goozzy

*ld: library not found for -lz.1.2.3*
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?

这很奇怪 - 我为iOS编译了一个版本,但是得到了关于Mac OS部署目标的错误.

Jim*_*Jim 43

您不应链接libz.dylib任何特定版本.正确的版本会自动使用.

  • 使用符号链接来模糊次要版本号更改是一种惯例,只要有共享库就可以使用它.它无处不在,古老而且无处不在.你不妨问一下定义/作为默认路径分隔符的文档在哪里 - 我确定它隐藏在某些UNIX标准的深处,但我不认为加入这个答案会特别有启发性.如果你想花时间挖掘它,请随意编辑我的答案. (3认同)

Jan*_*ano 3

将项目定义中的 libz dylib 版本更新为 XCode 4.2 提供的版本。如果您为不同的目标编译相同的代码,请检查每个目标的库版本。

由于 SDK 3.2 所有版本的 libz 都是指向最后一个版本(SDK 4.3 中的 libz.1.2.3)的符号链接,因此无论您选择哪个 libz 版本,您都会获得最后一个版本。请参阅 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/Symbols/usr/lib。

不知道苹果未来会做什么。如果您链接到 libz,您可能会继续链接到最新版本。库 (libz-X) 主编号的更改可能会破坏兼容性,因此更安全的选择是继续链接您现在拥有的相同版本。你的选择。