realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.3k stars 2.14k forks source link

Can't Install Realm v10.0+ via Cocoapods (v1.10) #6967

Closed ReveelTeam closed 3 years ago

ReveelTeam commented 3 years ago

Issue

Cannot install Realm v10.0+ via Cocoapods. Have tried each release (from 10.0.0) up to 10.1.4 - no luck. All other repos reinstall fine but not Realm v10.0+

Goals

Install Realm v10.1.4

Expected Results

Install Realm v10.1.4

Actual Results

ERROR OUTPUT (e.g. 10.1.4 attempt): [!] Failed to download 'Realm': [!] /bin/bash -c set -e sh build.sh cocoapods-setup

Downloading dependency: sync 10.1.3 from https://static.realm.io/downloads/sync/realm-sync-xcframework-10.1.3.tar.xz Undefined symbols for architecture x86_64: "_isPlatformVersionAtLeast", referenced from: realm::util::network::SecureTransportErrorCategory::message(int) const in librealm-sync-dbg.a(network_ssl.o) realm::util::network::ssl::Stream::verify_peer() in librealm-sync-dbg.a(network_ssl.o) realm::util::(anonymous namespace)::ensure_reclaimer_thread_runs() in librealm-sync-dbg.a(file_mapper.o) realm::util::terminate_internal(std::1::basic_stringstream<char, std::1::char_traits, std::1::allocator >&) in librealm-sync-dbg.a(terminate.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps for others to Reproduce

Code Sample

I have tried the standard way in the podfile: 'RealmSwift', '~> 10.1.4' ... and also tried ... using the following instead:

pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', submodules: true pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', submodules: true ... and then at bottom of file ... post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' config.build_settings['EXCLUDED_ARCHS[sdk=watchsimulator*]'] = 'arm64' config.build_settings['EXCLUDED_ARCHS[sdk=appletvsimulator*]'] = 'arm64' end {{ end}} end

Version of Realm and Tooling

Realm framework version: ? current 4.4.1 attempting for 10.1.4

Realm Object Server version: ? 3.23 attempting MongoDB Realm, Cloud

Xcode version: ? 11.5 with valid achitectures including 'arm64' and 'arm64e'

iOS/OSX version: ? N/A (though min target 10.0)

macOS version:? 10.15.7 (Catalina)

Dependency manager + version: ? cocoapods v1.10 (and only v1.10 - removed older versions) I have completely uninstalled (thoroughly) Cocoapods to install v1.10 and also have deintegrated this repo – all without luck. I have also tried the (shown above) alternative suggestion (not using ‘RealmSwift’, ‘~> 10.1.4’) for the podfile; which has not helped either. Additionally, please know that I have tried (completely) deleting the pods and even removed the Derived Data too - all to no avail.

pavel-ship-it commented 3 years ago

Hi @ReveelTeam , Is it working for you on XCode 12? Both Podfile contents are valid so you can just stick to the simplest - pod 'RealmSwift', '~> 10.1.4'

ReveelTeam commented 3 years ago

@pavel-ship-it

I just tried with Xcode 12.2 and it does not. I had previously tried Xcode 12.0.1 too. Though, currently (bc of dependencies) can't use Xcode 12.0+.

If it matters, I am using 'cocoapods-wholemodule' and its version is '0.0.1'; which has never been an issue before. Here is the complete list: cocoapods (1.10.0) cocoapods-core (1.10.0) cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) cocoapods-search (1.0.0) cocoapods-trunk (1.5.0) cocoapods-try (1.2.0) cocoapods-wholemodule (0.0.1)

ReveelTeam commented 3 years ago

@pavel-ship-it

I decided to try each version starting from Realm v5.0.0 and found that once I go past 5.3.5. I get similar failures going from 5.0.0 directly to a target above 5.3.5; which (same as above) errors would vary by showing different target values - Examples: attempt to 5.3.6 shows failure with 'sync' 5.0.20 -OR- for attempting 5.4.0 shows a failure with 'sync' 5.0.22. Though if I incremented from 5.3.5 to 5.3.6 a [first time] error populated (see below).

_(Actual outer path has been sanitized with '')_ ERROR POPULATED: Errno::ENOENT - No such file or directory @ rb_check_realpath_internal - /<PATH_TO>/<FURTHER_PATH_TO>/Pods/Realm/include/Realm/RLMAccessor.h /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/project.rb:326:in 'realpath' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/project.rb:326:in 'realpath' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/project.rb:326:in 'reference_for_path' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/project.rb:269:in 'add_file_reference' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:224:in 'block (2 levels) in add_file_accessors_paths_to_pods_group' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:223:in 'each' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:223:in 'block in add_file_accessors_paths_to_pods_group' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:213:in 'each' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:213:in 'add_file_accessors_paths_to_pods_group' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:96:in 'block in add_source_files_references' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:145:in 'message' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:95:in add_source_files_references' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb:46:in 'install!' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator.rb:102:in 'block in install_file_references' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:145:in 'message' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator.rb:100:in 'install_file_references' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/single_pods_project_generator.rb:17:in 'generate!' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:312:in 'block in create_and_save_projects' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in 'section' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:307:in 'create_and_save_projects' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:299:in 'generate_pods_project' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:178:in 'integrate' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:166:in 'install!' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in 'run' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334:in 'run' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in 'run' /<PATH_TO>/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/bin/pod:55:in '<top (required)>' /<PATH_TO>/.rbenv/versions/2.7.1/bin/pod:23:in 'load' /<PATH_TO>/.rbenv/versions/2.7.1/bin/pod:23:in '<main>'

pavel-ship-it commented 3 years ago

This is interesting, Errno::ENOENT - No such file or directory @ rb_check_realpath_internal - ///Pods/Realm/include/Realm/RLMAccessor.h Could you please check the path - it should be '///Pods/Realm/include/RLMAccessor.h' while you have this second '/Realm' element

ReveelTeam commented 3 years ago

@pavel-ship-it

I should have mentioned that I had already looked there. Of course, when going from 5.3.5 to 5.3.6 (before installing) the directory is there. Though, once the attempt is made, there is not one for .../Pods/Realm/ - which is after the install failed.

Here is a link for an issue posted with Cocoapods: https://github.com/CocoaPods/CocoaPods/issues/9493

Let me know what you are thinking to do or try ...

Thank you!

pavel-ship-it commented 3 years ago

Just to be clear, you did try to follow the recommendation in that post and it didn't work out, did you?

ReveelTeam commented 3 years ago

@pavel-ship-it

Yup

ReveelTeam commented 3 years ago

@pavel-ship-it

I saved the before and after for that so that we can go back to look at it. Let me know if I can help ...

pavel-ship-it commented 3 years ago

I think it's not a problem of a certain pod. Did you try to install/upgrade/reinstall another pod in the same project?

ReveelTeam commented 3 years ago

@pavel-ship-it

_### [UPDATED at 2020-12-04 @ 12:25PM ET ]_

Yes, other pods are updating fine; I can update Realm pods too just not higher than '5.3.5'. Also, as I mentioned initially, I have done a full removal (which isn't quick) Cocoaopods and then reinstalled Cocoaopods (v1.10), and the Realm pod too. Here is what I had done after it was failing:

  1. Remove Realm Pod (removed Realm Pod each time for each step below)
  2. deintegrate
  3. reinstall Cocoaopods v1.10
  4. remove older version of Cocoaopods (v1.9.2)
  5. fully remove Cocoaopods (manual remove each and the global directory, etc) & reinstall only v1.10 with wholemodules

Any thoughts for something else?

P.S. as a reminder I had tried both ways to install Realm Pod too, which now am only using: 'RealmSwift", '~> 10.1.4'

ReveelTeam commented 3 years ago

@pavel-ship-it

_### [UPDATED at 2020-12-04 @ 12:25PM ET ]_

I just had another idea to try, but it did not work. Here is what I did:

  1. Remove Realm from PodFile - to have Cocoapods remove it.
  2. Then run through to remove an crumbs of Realm
  3. Then do a repo update
  4. Then remove the Release & Specs (per that issue posted with CocoaPods)
  5. Then do a repo update
  6. Then add Realm (directly to v5.3.6 thru v10.1.4, not v5.3.5 to v5.3.6) back into PodFile and do an install

... but it still failed ...

ERROR OUTPUT to v10.1.4 (same for v5.3.6 - v10.1.4 & not if from v5.3.5 to v5.3.6): [!] /bin/bash -c set -e sh build.sh cocoapods-setup

Downloading dependency: sync 10.1.3 from https://static.realm.io/downloads/sync/realm-sync-xcframework-10.1.3.tar.xz Undefined symbols for architecture x86_64: "_isPlatformVersionAtLeast", referenced from: realm::util::network::SecureTransportErrorCategory::message(int) const in librealm-sync-dbg.a(network_ssl.o) realm::util::network::ssl::Stream::verify_peer() in librealm-sync-dbg.a(network_ssl.o) realm::util::(anonymous namespace)::ensure_reclaimer_thread_runs() in librealm-sync-dbg.a(file_mapper.o) realm::util::terminate_internal(std::__1::basic_stringstream<char, std::1::char_traits, std::__1::allocator >&) in librealm-sync-dbg.a(terminate.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Suri1044 commented 3 years ago

@pavel-ship-it: Any update on this ?

pavel-ship-it commented 3 years ago

@ReveelTeam could you please try with the new version 10.2.0?

tgoyne commented 3 years ago

___isPlatformVersionAtLeast is a function supplied by the platform SDK. Another report of this issue that we've seen had output suggesting that clang was pointing at a non-Xcode version of clang. Is that something that could be happening for you?

ReveelTeam commented 3 years ago

@pavel-ship-it I will give it a shot and let you know.

@tgoyne It shouldn't but I will look into it too.

ReveelTeam commented 3 years ago

@pavel-ship-it

Nope. Here are all the ways I tried (that failed):

  1. Tried from original 4.4.1 to 10.2.0
  2. Completely removed Realm and tried from no version to directly to 10.2.0
  3. Completely removed Realm and then successfully installed 5.3.5; then tried to go to 10.2.0 (from 5.3.5)

... notice they all are still sticking with the 10.1.3 framework downloading when the issue occurs, even for 10.2.0 ERROR OUTPUT (when trying to get to v10.2.0): [!] /bin/bash -c set -e sh build.sh cocoapods-setup

Downloading dependency: sync 10.1.3 from https://static.realm.io/downloads/sync/realm-sync-xcframework-10.1.3.tar.xz Undefined symbols for architecture x86_64: "_isPlatformVersionAtLeast", referenced from: realm::util::network::SecureTransportErrorCategory::message(int) const in librealm-sync-dbg.a(network_ssl.o) realm::util::network::ssl::Stream::verify_peer() in librealm-sync-dbg.a(network_ssl.o) realm::util::(anonymous namespace)::ensure_reclaimer_thread_runs() in librealm-sync-dbg.a(file_mapper.o) realm::util::terminate_internal(std::__1::basic_stringstream<char, std::1::char_traits, std::__1::allocator >&) in librealm-sync-dbg.a(terminate.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

ReveelTeam commented 3 years ago

@tgoyne

I do not have anything pointing to earlier version of Xcode nor a non-Xcode. I quickly read through some other posts. What I am seeing those posts for different Pods (e.g. 'SinchRTC'), they have a '___isPlatformVersionAtLeast' issue with recent releases stemming from [inclusion of] adding Xcode 12.0+. Their errors are from a code-compiling issue and not a pod install (like I am having). Those other issues are attempting to fix with adding 'arm64' as an architecture, or related - from what I've (quickly) seen. With that, I've always have had 'arm64' and 'arm64e' (along with others like: 'arm7', 'arm7s') as my 'valid architectures'. Anyhow, please let me know if you'd like me to look into something or try something ...

Side note: I do have 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' which is set to use my 'valid architectures' & 'build active architecture only' too.

The issue here for Pod install, shows '___isPlatformVersionAtLeast' to be from: Realm->Util - is there anything there to investigate?

ReveelTeam commented 3 years ago

@tgoyne

Is there something in new versions of Realm that is a breaking change, related to Realm-> Util, and that could be part of an iOS platform change too? -if so, that could be where to investigate ...

P.S. Manually adding the Realm (v10.1.4) frameworks does work just not via Cocoapods. Not sure about the potential app store submission issue, even with the script.

ReveelTeam commented 3 years ago

@tgoyne and @pavel-ship-it

For a manual Realm framework usage (not via Cocoapods), is it true that as of v10.2.0 there is no need for the script? -it was used for the App Store submission issue (bug). Basically, want to confirm that it is (now) safe to use a framework copy, since it does not show needing to use the script as of v10.2.0 ...

tgoyne commented 3 years ago

strip-frameworks.sh is no longer needed with Realm 10.2.0+. It was a workaround for the fact that the app store doesn't like combined simulator+device libraries, and switching to packaging as an xcframework eliminates that.

ReveelTeam commented 3 years ago

@tgoyne

Thanks for the info on the issue/bug for app submission and thanks for that fix too. Wanted to make sure the new instructions were not an oversight.

Any thoughts for the issue for using Cocoapods for installing Realm 5.3.6 or higher? - I have also tried [failed] newest release for v10.3.0

leemaguire commented 3 years ago

@ReveelTeam are you still having issues with installing the latest version via pods? Realm has now full sync support via SPM if you would like to try that.

pavel-ship-it commented 3 years ago

It seems the original issue has been fixed now so I'll close this ticket. If the you still see the same issue please comment and we can re-open it.