Realm-cocoa: WatchOS - undefined symbols for architecture i386

Created on 31 Oct 2015  路  6Comments  路  Source: realm/realm-cocoa

When trying to link with a watch app extension, for example using:

target 'Watch App Extension' do
  platform :watchos, '2.0'
  pod 'Realm'
end

I get errors such as (about 200 of them):

Undefined symbols for architecture i386:
"realm::BpTreeBase::replace_root(std::__1::unique_ptr<realm::Array, std::__1::default_delete<realm::Array> >)", referenced from:
      realm::Column<long long, false>::replace_root_array(std::__1::unique_ptr<realm::Array, std::__1::default_delete<realm::Array> >) in object_store.o
      realm::BpTree<long long, false>::EraseHandler::replace_root_by_leaf(realm::MemRef) in object_store.o
      realm::BpTree<long long, false>::EraseHandler::replace_root_by_empty_leaf() in object_store.o
      realm::BpTree<long long, false>::clear() in object_store.o
      realm::Column<long long, false>::replace_root_array(std::__1::unique_ptr<realm::Array, std::__1::default_delete<realm::Array> >) in RLMAccessor.o
      realm::BpTree<long long, false>::EraseHandler::replace_root_by_leaf(realm::MemRef) in RLMAccessor.o
      realm::BpTree<long long, false>::EraseHandler::replace_root_by_empty_leaf() in RLMAccessor.o

I also got the same errors when trying to add RealmSwift instead of Realm and with explicit use of use_frameworks!. The errors occur when building any target for any device or simulator.

ProductName:    Mac OS X
ProductVersion: 10.11.1
BuildVersion:   15B42

/Applications/Xcode.app/Contents/Developer
Xcode 7.1
Build version 7B91b

/usr/local/bin/pod
0.39.0
Realm (0.96.2)

/bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)

carthage not found
(not in use here)

/usr/bin/git
git version 2.4.9 (Apple Git-60)
T-Help

Most helpful comment

I can reproduce the same issue. I've resolved by deleting the cache of CocoaPods then re-install.
Can you please try:

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

All 6 comments

I can reproduce the same issue. I've resolved by deleting the cache of CocoaPods then re-install.
Can you please try:

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

I can confirm that this resolves the issue, although now the '-Swift.h' header does not contain any information about my Swift classes anymore. But this seems unrelated to me.

I seem to still be getting the exact same issue with Cocoapods 1.0.0.beta.8, Realm 0.98.8 and WatchOS 2.0. Following the steps above (including pod deintegrate) does not work. Here is my Podfile:

platform :ios, '9.3'

target 'ClearSkyChart' do
  pod 'SDWebImage', '~> 3.6'
  pod 'CCHMapClusterController', '~> 1.6'
  pod 'FlurrySDK', '~> 5.1'
  pod 'iRate', '~> 1.10.2'
  pod 'KSReachability', '~> 1.4'
  pod 'PulseSDK', '~> 0.2'
  pod 'uservoice-iphone-sdk'
  pod 'Realm'

  target 'ClearSkyChart WatchKit Extension' do
    platform :watchos, '2.0'
    pod 'Realm'
  end

  target 'ClearSkyChartTests' do
    pod 'Realm/Headers'
  end

end

Any ideas?

@ahanmal posting on old issues won't help. Please file a new issue with full reproduction steps and we'll take the time needed to identify what's wrong in either your configuration or if there's a bug in Realm. Thanks!

@jpsim Thanks - I'll open another issue.

pod cache clean Realm
pod cache clean RealmSwift
pod deintegrate || rm -rf Pods
pod install --verbose
rm -rf ~/Library/Developer/Xcode/DerivedData

That fix my problem

Was this page helpful?
0 / 5 - 0 ratings