To be able to build the realm project with xcode 10 beta 1 OR be included as a dependency with Carthage.
For the build to pass...
I get a failed build that looks like this:

<SOURCE_DIR>/Carthage/Checkouts/realm-cocoa/Realm/module.modulemap:1:18: error: redefinition of module 'Realm'
framework module Realm {
^
<HOME_DIR>Library/Caches/org.carthage.CarthageKit/DerivedData/10.0_10L176w/realm-cocoa/v3.7.1/Build/Intermediates.noindex/ArchiveIntermediates/Realm/IntermediateBuildFilesPath/Realm.build/Release-iphoneos/Realm.build/module.modulemap:1:18: note: previously defined here
framework module Realm {
^
1 error generated.
I even tried opening the project in Xcode 10 to build it manually and got the exact same issue.
update or bootstrapNote:
Not that this should matter but I also have Xcode 9.2 and Xcode 9.4 installed on my computer but named different app names. Before running any carthage commands I make sure the DEVELOPER_DIR is set to the right xcode app and I make sure xcode-select -p indicates I am using the right version of Xcode too.
Hunch:
When I opened the project I saw 2 modulemap files in source and I am wondering if something in Xcode changed in beta 1 that you are not aware of. Also for a side note, when I look at the full logs for the xcodebuild from Carthage it looks like it's error on the Objective-C compilation steps and not Swift...
Realm framework version: 3.7.1
Realm Object Server version: N/A
Xcode version: Xcode 10 beta 1
iOS/OSX version: iOS 12
Dependency manager + version: Carthage 0.29.1
I'm able to build Realm in Xcode 10, but it blows up when we include via Carthage.
Some relevant log bits:
Build system information
error: error: accessing build database "/Users/user/Library/Caches/org.carthage.CarthageKit/DerivedData/10.0_10L176w/realm-cocoa/v3.7.1/Build/Intermediates.noindex/ArchiveIntermediates/Realm/IntermediateBuildFilesPath/XCBuildData/build.db": disk I/O error
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/user/Library/Caches/org.carthage.CarthageKit/DerivedData/10.0_10L176w/realm-cocoa/v3.7.1/Build/Intermediates.noindex/ArchiveIntermediates/Realm/IntermediateBuildFilesPath/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/RLMRealmUtil.o /Users/user/Documents/code/MagicPhotos/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmUtil.mm normal armv7 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/user/Library/Caches/org.carthage.CarthageKit/DerivedData/10.0_10L176w/realm-cocoa/v3.7.1/Build/Intermediates.noindex/ArchiveIntermediates/Realm/IntermediateBuildFilesPath/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/RLMProperty.o /Users/user/Documents/code/MagicPhotos/Carthage/Checkouts/realm-cocoa/Realm/RLMProperty.mm normal armv7 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
... etc
That one looks like a bug that should be filed with apple.
FYI, xcode-select to Xcode 9 and then carthage update worked. Switched back to Xcode 10b1 for development. Works.
Not sure if that's an apple bug or what. Other things compile properly with carthage. ¯_(ツ)_/¯
nvm, still blocked. Should have realized that wouldn't work once I imported a module since it's swift 4.1.2 vs 4.2
I tried the following steps and it appears to have eventually built successfully:
$ DEVELOPER_DIR=/Applications/Xcode-10.app/Contents/Developer xcrun swift -version
Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3)
$ carthage version
0.29.0
$ echo 'github "realm/realm-cocoa"' > Cartfile
$ rm -rf ~/Library/Developer/Xcode/DerivedData
$ DEVELOPER_DIR=/Applications/Xcode-10.app/Contents/Developer carthage bootstrap
Aha! That did the trick. DEVELOPER_DIR seems to be the key. Why is that necessary?
Above steps do not work for me, any ideas? Thanks
DEVELOPER_DIR is the global system override to set the right xcodebuild tools as mentioned here.
Having the same issue with Cocoapod instead of Carthage
Having the same issue with Cocoapod instead of Carthage
For Cocoapod this helped me:
Close Xcode
rm -rf ~/Library/Developer/Xcode/DerivedData
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer pod install
Clean project rebuild
This helps?
How about Troubleshoothing section ? :)
How was this solved? I'm still getting it with Realm 3.17.3 and Xcode 11.3.1
Most helpful comment
I tried the following steps and it appears to have eventually built successfully: