16
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

How do I fix this error?

It's very strange -- I compile a build for iOS, but get a error about Mac OS deployment target.

Felipe Sabino
  • 17,825
  • 6
  • 78
  • 112
yariksmirnov
  • 489
  • 5
  • 10

2 Answers2

43

You should link libz.dylib not any specific version. The correct version gets used automatically.

Jim
  • 72,985
  • 14
  • 101
  • 108
  • This answer would be greatly improved if you could point to the relevant docs which indicates linking to a non-version-specific dylib will automatically use the latest. – memmons Jul 25 '11 at 22:25
  • 3
    Using symlinks to obscure minor version number changes is a convention that's been used as long as there have been shared libraries. It's ubiquitous and ancient. You might as well ask where the documentation is that defines / as the default path separator - I'm sure it is buried somewhere in the depths of some UNIX standard, but I don't think it's particularly enlightening to add to this answer though. Feel free to edit my answer if you want to spend the time digging it up though. – Jim Jul 25 '11 at 23:43
  • 1
    Thanks for clarifying. I asked because -- not coming from a C++ background -- I thought it might be Xcode specific. BTW, I already upvoted the answer. – memmons Jul 26 '11 at 16:44
3

Update the libz dylib version in your project definition to whatever your XCode 4.2 is providing. If you are compiling the same code for different targets, check the library version on each of them.

Since SDK 3.2 all versions of libz are symbolic links to the last version (libz.1.2.3 in SDK 4.3), so regardless of what libz-version you choose, you get the last one. See /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/Symbols/usr/lib.

I don't know what Apple will do in the future. If you link to libz you are likely to keep linking to the latest version. A change in the major number of the library (libz-X) could break compatibility, so a safer choice is to keep linking the same version you have now. Your choice.

Jano
  • 62,815
  • 21
  • 164
  • 192