添加 Realm Cocoapod 时出现重复符号 [英] Duplicate Symbols when adding Realm Cocoapod

查看:44
本文介绍了添加 Realm Cocoapod 时出现重复符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试在实际项目中使用 Realm,并且我已经通过 Cocoapods 成功添加了它.我使用的是 Xcode 6.4,但在同一台机器上安装了 Xcode 7.1 beta(用于其他项目).

I’m trying to use Realm for the first time in a real project, and I’ve added it via Cocoapods successfully. I’m using Xcode 6.4, but have the Xcode 7.1 beta installed on the same machine (for other projects).

尝试构建项目或运行单元测试(在模拟器上)时,我收到一个链接器错误,提示有数十对文件重复.看起来一个提到了 Bitcode,一个没有.

When attempting to build the project or run unit tests (on the Simulator), I get a linker error saying that dozens of pairs of files are duplicated. Looks like one mentioned Bitcode and one doesn’t.

我使用的是 Xcode 6.4 – 为什么它甚至知道 Bitcode?以下是错误的一小部分示例:

I’m using Xcode 6.4 – why does it even know about Bitcode? Here’s a small sample of the errors:

duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(row-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(row-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(spec-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(spec-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(table-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(table-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(table_view-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(table_view-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(unicode-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(unicode-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(utilities-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(utilities-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.cmdline in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(version-iPhoneSimulator-bitcode.o)
duplicate symbol _llvm.embedded.module in:
    /Users/me/Source/our-project-ios/Pods/Realm/core/librealm-ios.a(bptree-iPhoneSimulator-bitcode.o)

我看到其他人讨论过类似的问题,但不是 Xcode 6.4,也不是简单地运行应用程序,而不是提交到商店.

I’ve seen other people talking about similar issues but not with Xcode 6.4, and not with simply running the app, as opposed to submitting to the store.

我还应该指出,将 Realm 添加为静态框架(来自 0.95.3xcode-6 文件夹,效果很好,所以这与似乎是我从 Cocoapods 获得的.

I should also point out that adding Realm as a static framework (from the xcode-6 folder of 0.95.3 works perfectly, so it’s something to do with the build I’m getting from Cocoapods, it seems.

我可以在这里做什么?如果可能的话,我真的宁愿从 Cocoapods 那里得到它.

What can I do here? I’d really rather get it from Cocoapods if possible.

推荐答案

根据您使用的 Xcode 版本,需要不同版本的 Realm 核心库,因此使用 xcode-select 当您运行 pod install 时,您将使用它来构建项目.由于下载了 Xcode 7 版本的库,您可能已经激活了该版本的 Xcode.运行 sudo xcode-select -s/Applications/Xcode.app/Contents/Developer(假设您安装了 Xcode 6;根据需要进行调整),删除 Pods> 目录,然后重新运行 pod install.

Different versions of the core library for Realm are needed depending on which version of Xcode you're using, so it's important that the same version be activated with xcode-select when you run pod install as you will use to build the project. Since the Xcode 7 version of the library was downloaded, you probably had that version of Xcode active. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer (assuming that is where you have Xcode 6 installed; adjust it as necessary), delete the Pods directory, and then rerun pod install.

您可以使用 xcrun swiftc -v 检查您激活的 Xcode 版本.

You can check which version of Xcode you have active with xcrun swiftc -v.

这篇关于添加 Realm Cocoapod 时出现重复符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆