0

I created a new Swift app with xcode 11.4 and I am trying to install the pod for Mongodb Realm as per the instructions in the documentation (https://docs.mongodb.com/realm/ios/install/#ios-install). But when I do "pod install" I am getting this error:

*Installing Realm (10.0.0-beta.6)
[!] /bin/bash -c 
set -e
sh build.sh cocoapods-setup
Downloading dependency: sync 10.0.0-beta.14 from https://static.realm.io/downloads/sync/realm-sync-cocoa-10.0.0-beta.14.tar.xz
Undefined symbols for architecture x86_64:
  "___isPlatformVersionAtLeast", referenced from:
      realm::util::(anonymous namespace)::ensure_reclaimer_thread_runs() in librealm-sync-ios-dbg.a(file_mapper.o)
      realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in librealm-sync-ios-dbg.a(terminate.o)
      realm::util::network::SecureTransportErrorCategory::message(int) const in librealm-sync-ios-dbg.a(network_ssl.o)
      realm::util::network::ssl::Stream::verify_peer() in librealm-sync-ios-dbg.a(network_ssl.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)*

My podfile is as per instructions:

*platform :ios, '12.0'
target 'TEST' do
  
  use_frameworks!
  
  pod 'RealmSwift', '=10.0.0-beta.6'
end*

I am following the exact instructions and so why is this happening?

大陸北方網友
  • 3,696
  • 3
  • 12
  • 37
kangarooChris
  • 718
  • 1
  • 10
  • 21

1 Answers1

1

I would say the issue could be the podfile or that XCode was initially launched from another location (like a disk image or the downloads folder) and/or there are multiple XCode versions installed.

Podfile:

Looks like it's missing some components or may be malformed (which is why I asked if it was the exact podfile in my comments)

Here's what it should look like

project 'Test.xcodeproj'
target 'Test' do
  use_frameworks!
  pod 'RealmSwift', '=10.0.0-beta.6'
  #                   ^^^  or whatever the current vers is
end

I just built a brand new MongoDB Realm project with this podfile and it worked correctly.

Also ensure your cocoapods is up-to-date as well. Either

sudo gem install cocoapods

or for us dealing with an error for that

sudo gem install -n /usr/local/bin cocoapods

Be sure you can access the latest Realm versions by ensuring your pods are up-to-date

pod repo update

XCode:

If it was initially launched from another location is won't know where it's files are. The fix is a delete and reinstall from the AppStore and/or realigning it's files with this in terminal:

xcode-select --switch /Applications/Xcode.app
Jay
  • 34,438
  • 18
  • 52
  • 81
  • just followed your comments but still same error message. What puzzles me in the error message is this part "Undefined symbols for architecture x86_64:" - how can this be? is this the pod for something else than than iOS – kangarooChris Oct 09 '20 at 23:32
  • @kangarooChris I tried two projects; on one Mac that has macOS 10.14 (Mojave) and XCode 11 and another that has 10.15 (Catalina) with XCode 12. Both projects were for iOS. I also built two macOS projects and it works for that as well. Two suggestions; ensure you are completely quit out of XCode when adding the pod. Also, you may have an old version of cocoapods. Try updating it. – Jay Oct 10 '20 at 14:04
  • @kangarooChris Still not working is a bit vague. Are you using the podfile in your original question or the one shown in mine? What version of XCode are you now using - still 11? I just built another project (macOS) 10.14, XCode 11 and a copy/paste of the podfile in my answer and it works correctly so there is some difference between your environment and mine. – Jay Oct 15 '20 at 16:16
  • I am following your exact instructions. I have updated CAtalina to latest version 10.15.7 . and I am using Xcode 11.4.1 . Will update to 12 today. Also, I raised a ticket with mongrodb Realm team. – kangarooChris Oct 16 '20 at 22:30
  • @kangarooChris I don't know if a ticket is going to help since it's working for others but not for you. That would indicate an issue within your environment. I built yet another new project this morning using MongoDB Realm with the update 10.0.0 and it's working perfectly. Can you update your question with the current podfile and other version details about the project? Oh, you need to ensure your pods are up-to-date as well with `pod repo update` – Jay Oct 17 '20 at 16:30
  • now I updated to Xcode 12, deleted all other versions of Xcode on my computer and now I am getting this message: Analyzing dependenciesDownloading dependenciesInstalling Realm (10.0.0-beta.6)[!] /bin/bash -c set -esh build.sh cocoapods-setup WARNING: The active Xcode command line tools, as returned by 'xcode-select -p', are not from Xcode.         The newest version of Xcode will be used instead.Print: Entry, ":CFBundleVersion", Does Not Exist – kangarooChris Oct 18 '20 at 09:05
  • used the pod 'RealmSwift', '=10.0.0-beta.6' line in the pod file – kangarooChris Oct 18 '20 at 09:08
  • @kangarooChris Please update your **QUESTION** with details and your corrected podfile. As far as we can tell, your podfile is still incorrect. Also, your XCode installation is messed up - looks like it may have initially launched from another location. Ensure XCode is in your Applications folder and reset the path in terminal with `xcode-select --switch /Applications/Xcode.app`. Oh and see [this answer](https://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error/17980786#17980786) – Jay Oct 18 '20 at 12:46
  • so, got it working!!!! I am not sure why, but I think the main reason was that I had different Xcode versions on my computer which piled up because of multiple apps created over the time with different setups. Once all old Xcode versins were deleted and Xcode 12 was installed it started looking good. The thing with the latest error was that I unintentionally opened Xcode from the download folder exactly as you said. Once corrected it started working. Can you create an answer suggesting the above so that I can close this? Thanks for your support! – kangarooChris Oct 19 '20 at 00:49
  • @kangarooChris Awesome - glad we solved it! So frustrating. I updated this answer with additional information to cover our bases. – Jay Oct 19 '20 at 15:39