【问题标题】:Xcode 5.1 ld: library not found for -lGoogleAnalyticsServicesXcode 5.1 ld:找不到 -lGoogleAnalyticsServices 的库
【发布时间】:2014-04-18 10:29:08
【问题描述】:

今天我将我的 Xcode 更新到 Xcode 5.1,现在每次我尝试编译我的代码并在模拟器上测试它时,我都会遇到关于架构 86_64 和 Google Analytics Services Library 的几个错误。 这是我得到的:

Ld /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino normal x86_64
    cd "/Users/prelite/Desktop/iSanMarino 3.0"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export 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"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -L/Users/prelite/Desktop/iSanMarino\ 3.0/iSanMarino/Analytics -F/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -filelist /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -lGoogleAnalyticsServices -framework AudioToolbox -framework CoreData -framework QuartzCore -framework SystemConfiguration -lsqlite3 -framework EventKitUI -framework EventKit -framework CoreLocation -framework MessageUI -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino_dependency_info.dat -o /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino

Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_deflateEnd", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_deflateInit2_", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflate", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflateEnd", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflateInit2_", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我还更新了 Google Analytics Library 并尝试删除并阅读它,但没有。

【问题讨论】:

  • 我下载了新版本 3.03c,进行了清理和构建,一切恢复正常。我猜你的旧图书馆(比如我的)不支持这些架构。这是网址developers.google.com/analytics/devguides/collection/ios/…
  • 我已经尝试过了,我删除了所有的 .m 和 .h 以及框架文件...然后再次读取了 3.03c 的所有文件执行干净但没有任何改变...也许是问题在“构建设置”中...您在“搜索路径”和“有效架构”上设置了什么?
  • 将目标更改为 ïOSDevice 为我解决了问题。对于模拟器它不起作用。奇怪。

标签: xcode compiler-errors google-analytics ios7.1 xcode5.1


【解决方案1】:

如果您加载 .xcodeproj 文件并尝试构建它,您将收到此错误。打开包含的 .xcworkspace ,你会没事的。

要么选择“打开其他”并从您的项目目录中选择它,或者从您的项目目录中的命令提示符中选择它:

open <YourProjectName>.xcworkspace

应该不需要其他依赖项。

【讨论】:

    【解决方案2】:

    解决方案:我刚刚添加了 libz.dylib 框架,一切正常!

    【讨论】:

    • 谢谢。为我节省了很多时间。 V3 不向后兼容真的很烦人。与以前的版本相比,新方法需要更多的编码来做同样的事情。请接受您自己的答案作为正确答案。
    猜你喜欢
    • 2016-01-18
    • 1970-01-01
    • 2017-03-21
    • 2014-06-25
    • 2020-11-25
    • 2016-02-26
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    相关资源
    最近更新 更多