【问题标题】:Undefined symbol linker failure for Estimote SDKEstimote SDK 的未定义符号链接器失败
【发布时间】:2015-03-20 09:20:56
【问题描述】:

我正在尝试将 Estimote SDK 3.0 包含到我的项目中,但出现以下链接错误:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_ESTBeaconRegionWrapper", referenced from:
      objc-class-ref in EstimoteSDK(ESTSecureBeaconManager.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已将框架添加到“构建阶段”并检查框架搜索目录设置是否包含该目录。

我从 Estimote 下载了示例应用程序,它使用了相同的框架(我从那里复制它)并且构建良好。我看不出有什么明显的区别。

我怎样才能找出问题所在?

编辑: 我正在使用 Xcode 6.2。 我正在为 iPhone 6 构建(说架构 arm64、armv7、armv7s)。在下面的问题之后,我为 armv7s 构建,我得到了同样的错误(对于 armv7s)。所以框架链接肯定有问题。

编辑 2:我删除了 -ObjC 'Other linker flag',因为将其添加到 Estimote 项目会产生相同的错误。但是现在我得到了更多的错误:

Ld /Users/.../iDomsPortalDev normal arm64
    cd "/Users/.../idoms-portal"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -L/Users/.../Products/Debug-iphoneos -F/Users/.../Products/Debug-iphoneos -FiDoms/frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/.../Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -lxml2 -lc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework CrashReporter -framework EstimoteSDK -weak_framework Accelerate -weak_framework Social -weak_framework Twitter -framework MessageUI -framework MapKit -framework AVFoundation -framework SystemConfiguration -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/.../Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev_dependency_info.dat -o /Users/.../iDomsPortalDev

Undefined symbols for architecture arm64:
  "_CBAdvertisementDataServiceDataKey", referenced from:
      +[ESTDeviceDataHelper parseAdvertisingData:] in EstimoteSDK(ESTDeviceDataHelper.o)
  "_OBJC_CLASS_$_CBCentralManager", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
  "_kSecAttrService", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAfterFirstUnlock", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_OBJC_CLASS_$_CBUUID", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceAuth.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceEstimote.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceOta.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceSoftware.o)
      objc-class-ref in EstimoteSDK(ETBluetoothMath.o)
  "_kSecAttrAccessibleWhenUnlocked", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecReturnAttributes", referenced from:
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessible", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAlways", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
      -[ESTBeaconDevice startScanning] in EstimoteSDK(ESTBeaconDevice.o)
  "_SecItemDelete", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleAlwaysThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_SecItemUpdate", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessibleWhenUnlockedThisDeviceOnly", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_SecItemAdd", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_SecItemCopyMatching", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecClass", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecClassGenericPassword", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccount", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecValueData", referenced from:
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecAttrAccessGroup", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
      -[ESTKeychain setObject:forKey:] in EstimoteSDK(ESTKeychain.o)
      +[ESTKeychain bundleSeedID] in EstimoteSDK(ESTKeychain.o)
  "_kSecMatchLimitOne", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecMatchLimit", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
  "_kSecReturnData", referenced from:
      -[ESTKeychain dataForKey:] in EstimoteSDK(ESTKeychain.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[编辑 3:] 添加 Security.framework 后,似乎又迈出了一步:

Ld /Users/.../Products/Debug-iphoneos/iDomsPortalDev.app/iDomsPortalDev normal arm64
    cd "/Users/.../idoms-portal"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -L/Users/.../Products/Debug-iphoneos -F/Users/.../Library/Frameworks -filelist /Users/.../iDoms.build/Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -lxml2 -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework Security -framework CrashReporter -framework EstimoteSDK -weak_framework Accelerate -weak_framework Social -weak_framework Twitter -framework MessageUI -framework MapKit -framework AVFoundation -framework SystemConfiguration -framework MediaPlayer -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/Luuk/Library/Developer/Xcode/DerivedData/iDoms-gperwbbtttggqpcvozenraexrhrx/Build/Intermediates/iDoms.build/Debug-iphoneos/iDoms\ Dev.build/Objects-normal/arm64/iDomsPortalDev_dependency_info.dat -o /Users/Luuk/Library/Developer/Xcode/DerivedData/iDoms-gperwbbtttggqpcvozenraexrhrx/Build/Products/Debug-iphoneos/iDomsPortalDev.app/iDomsPortalDev

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CBCentralManager", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
  "_OBJC_CLASS_$_CBUUID", referenced from:
      objc-class-ref in EstimoteSDK(ESTBeaconDevice.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceAuth.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceEstimote.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceOta.o)
      objc-class-ref in EstimoteSDK(ESTBluetoothServiceSoftware.o)
      objc-class-ref in EstimoteSDK(ETBluetoothMath.o)
  "_CBAdvertisementDataServiceDataKey", referenced from:
      +[ESTDeviceDataHelper parseAdvertisingData:] in EstimoteSDK(ESTDeviceDataHelper.o)
  "_CBCentralManagerScanOptionAllowDuplicatesKey", referenced from:
      -[ESTBeaconDevice startScanning] in EstimoteSDK(ESTBeaconDevice.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

【问题讨论】:

  • 您是否检查过您使用的库是否有新版本?您能否提供一些有关您的应用架构和构建设置中的有效架构以及您使用的 XCode 版本的信息? (好像这个库不支持Arm64。)
  • 我添加了 Xcode 版本。它也不是为armv7s构建的,所以链接肯定有问题。可能是我必须做或忘记的一些小/简单的事情。
  • Estimote 示例项目没有设置链接器标志。
  • 嘿,来自 Estimote 的 Piotr,我们实际上认为这是一个错误,并且正在制定解决方案,请继续关注错误修复版本。
  • 不错!我们还有一些人报告说更改这些设置会有所帮助。不过,我们刚刚推出了 3.0.2,它应该可以解决这个问题而无需进行任何更改(:

标签: ios objective-c xcode estimote


【解决方案1】:

感谢上面的各种提示,我浏览了整个构建文件,发现了不同的标志。它是“启用模块”,在我的构建设置中设置为“否”。

【讨论】:

    【解决方案2】:

    【讨论】:

      【解决方案3】:

      我刚刚下载了https://github.com/Estimote/iOS-SDK 他们的 SDK 并成功地将其包含在示例项目中。

      在“Build Active Architecture Only”集中的“Build Settings”下 将“调试”设为YES

      也试试 在“常规”标签中

      • 在“链接框架和库”下添加框架。
      • 在“嵌入式​​二进制文件”下添加框架。

      确保 EstimoteSDK.framework 确实存在于其原始位置,您可能不小心删除了它。

      【讨论】:

      • 一些 OP 错误缺少 Security.framework 依赖项。你是如何设法在不需要它的情况下集成它的?你真的使用过框架的任何功能吗?
      • 我才刚刚开始集成它,但我已经在使用其中的一些类了。示例 App 中也不存在 Security.framework。
      • 我必须在我的构建设置中有所作为。只是不知道从哪里开始,这个项目已经有 3 年历史了,所以可能会从更早的 iOS 版本继承下来。
      • 有趣的是,当我添加 Security.framework 时,我得到不同(或更少?)的错误,见上面的edit3。还有其他建议吗?
      【解决方案4】:

      查看 podspec,它指定要添加到 OTHER_LDFLAGS-lc++ 标志。如果您没有设置此标志,则可能会导致此类问题。

      【讨论】:

      • 我想我明白问题所在了。我有 -ObjC 设置。如果我在 Estimote 项目上设置它也会失败,所以它一定在某个角落。我不记得为什么需要添加 -ObjC。如果我从现有项目中删除它,我会收到更多 Estimote 错误。我将在上面发布完整的错误列表。
      猜你喜欢
      • 2023-02-14
      • 1970-01-01
      • 2016-08-11
      • 1970-01-01
      • 1970-01-01
      • 2018-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多