Closed james-rant closed 5 years ago
Swift 4.2 works fine, just try it.
I don't know what you mean.
My project is written in Swift 4.2. Realm appears to be using Swift 3 (it specifies Swift 3 in the swift_version build setting in its Xcode Project). I updated to Xcode 10.2, opened my project and was told that Realm needed to be recompiled (cannot import module compiled using Swift 4.2 into Swift 5, etc), so I updated the Carthage builds and the build fails saying swift 3 is no longer supported.
Waiting for the official update, I just altered the Realm Xcode project from the Carthage/Checkout folder by setting every single Xcode target to use Swift 4.2.
Then I run carthage build realm-cocoa --platform iOS
.
its working.
@samueleperricone No, it is not working as expected. It compiles but it is buggy, because of some missing internal linking . Also, Simulator code compile breaks as well. Xcode 10.2 uses Swift 5 compiler and even by using Swift 4.2, you still need to compile it with swift compiler 5 to be able to use the framework.
Realm on Xcode 10.2, (Swift 5 compiler) , even by Swift 4.2 currently impossible. Yes, I have it working on a real Device, but Some parts still fails.
The other issue is the Realm Static files which are also not aligned and optimized for Swift 5 compilation
Yes exactly. I saw that there was a pull request to update to Swift 5, but it mentioned that many of the tests failed. I don't believe the solution is as simple as changing the swift version in the Xcode Project, I believe that is more likely to create hidden problems when using Realm in that manner.
For now I have had to revert back to Xcode 10.1.
@james-rantmedia @mjhatamy It is not a permanent solution, as I started by comment "Waiting for the official update".
So this is just a temporary workaround to continue the local development until the pull request to update to Swift 5 is approved and merged.
@samueleperricone Correct, but still even local development behave unexpectedly. My Experience was corrupted Realm Files. As long as your development does not rely on Realm it is fine.
Waiting eagerly for a stable release.
Realm 3.14 is up and works on Swift 5. I am going to do more deeper tests
3.14 doesn't build for me with the Swift 5 compiler. It segfaults trying to build LinkingObjects.swift
. (3.13 failed in the same way)
Let me know if this isn't the same issue, and I'll open a new one.
Here's the stack trace:
0. Program arguments: /Applications/Xcode-10.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Aliases.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Error.swift -primary-file /Users/david/src/esios/Pods/RealmSwift/RealmSwift/LinkingObjects.swift -primary-file /Users/david/src/esios/Pods/RealmSwift/RealmSwift/List.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Migration.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Object.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/ObjectiveCSupport.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/ObjectSchema.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Optional.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Property.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Realm.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/RealmCollection.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/RealmConfiguration.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Results.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Schema.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/SortDescriptor.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/SwiftVersion.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Sync.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/ThreadSafeReference.swift /Users/david/src/esios/Pods/RealmSwift/RealmSwift/Util.swift -emit-module-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects~partial.swiftmodule -emit-module-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List~partial.swiftmodule -emit-module-doc-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects~partial.swiftdoc -emit-module-doc-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List~partial.swiftdoc -serialize-diagnostics-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects.dia -serialize-diagnostics-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List.dia -emit-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects.d -emit-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List.d -emit-reference-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects.swiftdeps -emit-reference-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List.swiftdeps -target x86_64-apple-ios8.0-simulator -enable-objc-interop -sdk /Applications/Xcode-10.2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk -I /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Products/Debug-iphonesimulator/RealmSwift -F /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Products/Debug-iphonesimulator/RealmSwift -F /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Products/Debug-iphonesimulator/Realm -application-extension -enable-testing -g -import-underlying-module -module-cache-path /Users/david/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -suppress-warnings -sanitize=thread -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -D COCOAPODS -serialize-debugging-options -Xcc -working-directory -Xcc /Users/david/src/esios/Pods -enable-anonymous-context-mangled-names -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/RealmSwift-generated-files.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/RealmSwift-own-target-headers.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/RealmSwift-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/RealmSwift-project-headers.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Products/Debug-iphonesimulator/RealmSwift/include -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/DerivedSources-normal/x86_64 -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/DerivedSources/x86_64 -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG=1 -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -ivfsoverlay -Xcc /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/unextended-module-overlay.yaml -module-name RealmSwift -o /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects.o -o /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/List.o -index-store-path /Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Index/DataStore -index-system-modules
1. Running pass 'CallGraph Pass Manager' on module '/Users/david/Library/Developer/Xcode/DerivedData/EasyShift-azlbsiwymsaptwbfnlkbpiekojdp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RealmSwift.build/Objects-normal-tsan-ubsan/x86_64/LinkingObjects.o'.
2. Running pass 'Dominator Tree Construction' on function '@"$s10RealmSwift14LinkingObjectsCyxSicir.resume.0"'
0 swift 0x0000000112145ee3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x00000001121456bc SignalHandler(int) + 348
2 libsystem_platform.dylib 0x00007fff58bfab3d _sigtramp + 29
3 libsystem_malloc.dylib 0x00007fff58bc2b6b small_malloc_from_free_list + 432
4 swift 0x000000011201e991 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*) + 1025
5 swift 0x000000011201e583 llvm::DominatorTreeWrapperPass::runOnFunction(llvm::Function&) + 19
6 swift 0x00000001120615ad llvm::FPPassManager::runOnFunction(llvm::Function&) + 1613
7 swift 0x0000000110c3de27 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) + 2311
8 swift 0x000000011206da00 llvm::legacy::PassManager::run(llvm::Module&) + 1696
9 swift 0x000000010e183518 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5816
10 swift 0x000000010dfaa91e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 51566
11 swift 0x000000010df9a6de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
12 swift 0x000000010df387be main + 1246
13 libdyld.dylib 0x00007fff58a0fed9 start + 1
14 libdyld.dylib 0x000000000000007b start + 2808021411
error: Segmentation fault: 11
It builds for me (carthage from master) but when building the project i get an error for each class which inherits from Object.
So the exact error message is:
Cannot find interface declaration for 'RealmSwiftObject', superclass of 'WhateverRealmObject'
Does anybody else have this kind of problem?
Do not compile current master. use tag 3.14.0
I am having the same issue as before, header 'RealmSwift-Swift.h' not found, with this new version.
Do not compile current master. use tag 3.14.0
Thank you for the suggestion, unfortunately the error still remains. I guess the difference is, that you are using Realm directly in your MainTarget where i use it in a framework.
Reminds me somehow of: https://github.com/realm/realm-cocoa/issues/3073
Update: So if i set "Install Objective-C Compability Header" to "No" in the Build Settings of my Framework-Target it builds.
But so far i can't estimate the impacts of that setting. :-)
Update2:
Migration to Swift5 does not work for me. But Xcode 10.2 does at least.
Waiting eagerly for a stable release.
😄
A complete project which demonstrates issues with Xcode 10.2 and Realm 3.14 would be very helpful. I've been unable to reproduce any problems myself.
Hey @tgoyne,
here is a quick example app.
Steps to reproduce:
carthage update --platform ios
When you set "Install Objective-C Compability Header" to "No" (logic target) you are able to build the app, but migration to Swift 5 fails.
Thank you for your effort good Sir!
@aregler having your exact same issue, setting "Compatibility Header" to "No" on the framework does the trick, but that doesn't seem right to me
I was able to build and run on simulator by disabling the Thread Sanitizer. It is actually mentioned on Swift 5 Release Notes on this site: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes/swift_5_release_notes_for_xcode_10_2?preferredLanguage=occ
- Known Issues The Swift compiler may crash during a build when the Thread Sanitizer is enabled. (48719789) Workaround: Disable Thread Sanitizer in the Scheme Editor’s Diagnostics tab.
Hope this helps.
Enabling/Disabling the Thread Sanitizer https://developer.apple.com/documentation/code_diagnostics/thread_sanitizer/enabling_the_thread_sanitizer
The original problem this issue was raised for has been resolved since Realm 3.14 adds an Xcode 10.2 compatible binary for Carthage to download.
I would recommend that anyone experiencing the other issues being discussed in this thread open new issues to properly capture them.
Hey - looks like you forgot to add a T:* label - could you please add one?
Goals
Build RealmCocoa (Realm and RealmSwift) from source with Xcode 10.2 (no longer in beta as of 26th March 2019)
Expected Results
Expected Realm to build from source.
Actual Results
The build fails, because Swift 3 support has been dropped from the Swift compiler included with Xcode 10.2.
Steps to Reproduce
Attempt to build Realm from source using the command line tools included with Xcode 10.2
Version of Realm and Tooling
Realm framework version: 3.13.1 Xcode version: 10.2 iOS/OSX version: macOS 10.14.3, iOS 12.2
Dependency manager + version: Carthage 0.32.0