realm-swift: RealmSwift Does not build from source with Xcode 10.2 as Swift 3 support has been dropped.

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.

/usr/bin/xcrun xcodebuild -workspace /Users/james/dev/MyApp/Carthage/Checkouts/realm-cocoa/Carthage/Realm.xcworkspace -scheme RealmSwift -configuration Release -derivedDataPath /Users/james/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2_10E125/realm-cocoa/v3.13.1 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/89/zl8dhxjd64v9j1rrwhhpvbf80000gn/T/realm-cocoa SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/james/dev/MyApp/Carthage/Checkouts/realm-cocoa)User defaults from command line:
    IDEArchivePathOverride = /var/folders/89/zl8dhxjd64v9j1rrwhhpvbf80000gn/T/realm-cocoa
    IDEDerivedDataPathOverride = /Users/james/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2_10E125/realm-cocoa/v3.13.1

Build settings from command line:
    CARTHAGE = YES
    CLANG_ENABLE_CODE_COVERAGE = NO
    CODE_SIGN_IDENTITY = 
    CODE_SIGNING_REQUIRED = NO
    GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphoneos12.2
    SKIP_INSTALL = YES
    STRIP_INSTALLED_PRODUCT = NO

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'RealmSwift')

Build system information
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'RealmSwift')

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 38
  • Comments: 20 (1 by maintainers)

Most upvoted comments

Waiting eagerly for a stable release.

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

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.

😄

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

@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

Hey @tgoyne,

here is a quick example app.

Steps to reproduce:

  • carthage update --platform ios
  • build the test app

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!

TestApp.zip