归档iOS项目的问题:找不到libz.dylib

时间:2016-08-30 07:57:54

标签: ios xcode pspdfkit libz

从(旧版)iOS项目进行存档时遇到问题。归档时,我收到以下错误:

Libtool /Users/appcell/Library/Developer/Xcode/DerivedData/elho-ctuevlyyxtyssvblxkqezbfgdtyq/Build/Intermediates/ArchiveIntermediates/Elho/IntermediateBuildFilesPath/PSPDFKit-lib.build/Release-iphoneos/PSPDFKit.build/Objects-normal/armv7/libPSPDFKit.a normal armv7
cd /Users/appcell/Documents/Projects/Elho/Libraries/PSPDFKit
export IPHONEOS_DEPLOYMENT_TARGET=5.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/appcell/Library/Developer/Xcode/DerivedData/elho-ctuevlyyxtyssvblxkqezbfgdtyq/Build/Intermediates/ArchiveIntermediates/Elho/BuildProductsPath/Release-iphoneos -filelist /Users/appcell/Library/Developer/Xcode/DerivedData/elho-ctuevlyyxtyssvblxkqezbfgdtyq/Build/Intermediates/ArchiveIntermediates/Elho/IntermediateBuildFilesPath/PSPDFKit-lib.build/Release-iphoneos/PSPDFKit.build/Objects-normal/armv7/PSPDFKit.LinkFileList /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/libz.dylib -framework AssetsLibrary -framework CoreMedia -framework AVFoundation -framework ImageIO -framework MediaPlayer -framework CoreText -framework CoreGraphics -weak_framework UIKit -framework MessageUI -framework QuartzCore -framework Foundation -o /Users/appcell/Library/Developer/Xcode/DerivedData/elho-ctuevlyyxtyssvblxkqezbfgdtyq/Build/Intermediates/ArchiveIntermediates/Elho/IntermediateBuildFilesPath/PSPDFKit-lib.build/Release-iphoneos/PSPDFKit.build/Objects-normal/armv7/libPSPDFKit.a

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/libz.dylib (No such file or directory)

当我创建一个链接从/usr/lib/libz.dylib文件到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib(以前曾经工作过)时,我现在收到以下错误:

ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/libz.dylib, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/libz.dylib (2 slices)
Undefined symbols for architecture armv7:
"_deflateInit_", referenced from:
  -[NSData(PSPDFCompression) pspdf_zlibDeflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_deflate", referenced from:
  -[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
  -[NSData(PSPDFCompression) pspdf_zlibDeflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_deflateInit2_", referenced from:
  -[ASIDataCompressor setupStream] in ASIDataCompressor.o
"_inflate", referenced from:
  _unzReadCurrentFile in unzip.o
  -[ASIDataDecompressor uncompressBytes:length:error:] in ASIDataDecompressor.o
  -[NSData(PSPDFCompression) pspdf_zlibInflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_get_crc_table", referenced from:
  _unzOpenCurrentFile3 in unzip.o
"_inflateEnd", referenced from:
  _unzCloseCurrentFile in unzip.o
  -[ASIDataDecompressor closeStream] in ASIDataDecompressor.o
  -[NSData(PSPDFCompression) pspdf_zlibInflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_crc32", referenced from:
  _unzReadCurrentFile in unzip.o
"_inflateInit_", referenced from:
  -[NSData(PSPDFCompression) pspdf_zlibInflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_deflateEnd", referenced from:
  -[ASIDataCompressor closeStream] in ASIDataCompressor.o
  -[NSData(PSPDFCompression) pspdf_zlibDeflate] in libPSPDFKit.a(NSData+PSPDFCompression.o)
"_inflateInit2_", referenced from:
  _unzOpenCurrentFile3 in unzip.o
  -[ASIDataDecompressor setupStream] in ASIDataDecompressor.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有没有人遇到过同样的问题?

1 个答案:

答案 0 :(得分:0)

PSPDFKit创始人在这里。我们的PDF SDK使用libz,因此要么链接libz.dylib(已在以后的Xcode版本中重命名为libz.tbd),要么添加链接标志-lz,这应该可以解决问题。< / p>

如果您将我们的SDK更新到最新版本,这一切都会自动发生,因为我们正在使用一个已经知道它需要什么依赖项的动态框架。