Realm-cocoa: Undefined symbols for architecture x86_64

Created on 13 Aug 2015  路  12Comments  路  Source: realm/realm-cocoa

I am using the cocoapods objective c version in my project and linking gives me hundreds of errors. Such as:

Undefined symbols for architecture x86_64:
"realm::BpTreeBase::write_subtree(realm::Array const&, unsigned long, unsigned long, unsigned long, realm::BpTreeBase::SliceHandler&, realm::_impl::OutputStream&)", referenced from:
realm::BpTree::write(unsigned long, unsigned long, unsigned long, realm::_impl::OutputStream&) const in libRealm.a(RLMResults.o)
realm::BpTree::write(unsigned long, unsigned long, unsigned long, realm::_impl::OutputStream&) const in librealm.a(RLMResults.o)
realm::BpTree::write(unsigned long, unsigned long, unsigned long, realm::_impl::OutputStream&) const in libRealm.a(object_store.o)

osx 10.10, every other pod seems to work fine though. Any idea what linker option is missing? Thanks!

T-Bug

Most helpful comment

@ifeherva this can sometimes happen when downloading Realm has failed. Can you try running the following for me, and installing again? Thanks!

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

All 12 comments

@ifeherva this can sometimes happen when downloading Realm has failed. Can you try running the following for me, and installing again? Thanks!

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

I tried again on another computer where cocoapods were not even installed. The project is very simple, yet I get the same error.

How did you install Realm on the non-CocoaPods machine?

I mean everything was freshly installed so there was no need to wipe the cache from ~/Library. Even though I tried again and same result.

But did you also delete the Pods directory?

I'm getting the same error, I was just creating sample project to make a test on Realm for 10.10.
The project has nothing in (just created), just did a pod install. Also tried to remove everything linked to cocoa pods and install Realm again.

Moreover, I'm already using Realm (with cocoapods) in another project which is working perfectly.

Podfile:

source 'https://github.com/CocoaPods/Specs.git'
workspace './RealmTest.xcworkspace'
xcodeproj './RealmTest.xcodeproj'
inhibit_all_warnings!

platform :osx, '10.10'
pod 'Realm'

I can send the sample project if that can hep.

@tbaranes yes, a sample project that demonstrates the issue would be very helpful!

Just sent at [email protected]
Hope it helps :)

OK, figured this out. The issue is that the CocoaPods static library is named Realm, and Realm is also linking against a static library called realm -- thanks to running on case-insensitive file systems, there's no way to link them both. The immediate fix for you (if possible) is to add the use_frameworks! flag to the Podfile, and I'll pull together a PR here with a less hacky fix.

I'm getting again this error on OSX using CocoaPods, but this time using RealmSwift. Any issues about it?

@ifeherva this can sometimes happen when downloading Realm has failed. Can you try running the following for me, and installing again? Thanks!

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

saved my day :)

@ifeherva this can sometimes happen when downloading Realm has failed. Can you try running the following for me, and installing again? Thanks!

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
pod install

saved my day :)

save my day :)

Was this page helpful?
0 / 5 - 0 ratings