JohnEstropia / CoreStore

Unleashing the real power of Core Data with the elegance and safety of Swift
MIT License
4.01k stars 255 forks source link

Build fails on Xcode 8 / macOS Sierra (both for Swift 2.3 and 3) #113

Closed HealsCodes closed 8 years ago

HealsCodes commented 8 years ago

When trying to build CoreStore via Carthage (for use in one of my iOS apps) I'm running into this compiler crash:

Stored value type does not match pointer operand type!
  store %C9CoreStore21CSBaseDataTransaction* %23, %C9CoreStore28CSSynchronousDataTransaction** %0, align 8, !dbg !2529
 %C9CoreStore28CSSynchronousDataTransaction*LLVM ERROR: Broken function found, compilation aborted!
2016-10-20 13:46:56.454 xcodebuild[69083:526859]  DVTAssertions: Warning I in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-11246/IDEFoundation/Playgrounds/IDEPlaygroundAuxiliarySourceCompilerOperation.m:386
Details:  Unable to read diagnostics from file "/Users/shirk/Library/Developer/Xcode/DerivedData/CoreStore-dibsnzstxqdaakfnrpbesflgtiep/Build/Intermediates/CoreStore.build/Release/CoreStore OSX.build/Objects-normal/x86_64/CSListMonitor.dia" (Invalid File): Invalid diagnostics signature
Function: void XCGenerateDiagnosticsFromFile(NSString *__strong, NSString *__strong, NSDictionary *__strong, NSDictionary *__strong, IDEActivityLogSectionRecorder *__strong, BOOL (^__strong)(IDEActivityLogMessage *__strong))
Thread:   <NSThread: 0x7fbbc7b16f40>{number = 15, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

Command /Applications/Xcode.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/bin/swiftc failed with exit code 1
** BUILD FAILED **

The following build commands failed:
    CompileSwift normal x86_64
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler

Looking around the net this seems to be an issue with the swift compiler itself, but one that can be worked around be the code that triggers it.

I know it's not the fault of CoreStore but as it is I can't build the framework in any version (master / 2.1.0 / swift_3) and there is no saying when a fixed swift compiler will be included in a new Xcode release.

JohnEstropia commented 8 years ago

Thanks for the report. I'll check this out.

pointspy commented 8 years ago

I have the same problem...

Build fails on Xcode 8 / swift 3 / macOS EI Capitan

016-10-25 22:29:22.006 xcodebuild[31539:2558530] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-11246/IDEFoundation/Playgrounds/IDEPlaygroundAuxiliarySourceCompilerOperation.m:386 Details: Unable to read diagnostics from file "/Users/pavellyskov/Library/Developer/Xcode/DerivedData/CoreStore-bvebbsyydxxrbkhfszeyodbcelke/Build/Intermediates/CoreStore.build/Release-iphoneos/CoreStore iOS.build/Objects-normal/arm64/ObjectMonitor.dia" (Invalid File): Invalid diagnostics signature Function: void XCGenerateDiagnosticsFromFile(NSString _strong, NSString *strong, NSDictionary __strong, NSDictionary strong, IDEActivityLogSectionRecorder *strong, BOOL (^strong)(IDEActivityLogMessage *strong)) Thread: <NSThread: 0x7f7fde855040>{number = 4, name = (null)} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. *_ BUILD FAILED **

The following build commands failed: CompileSwift normal arm64 CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures) A shell task (/usr/bin/xcrun xcodebuild -workspace "/Users/pavellyskov/Documents/Xcode projects/iXpenses/Carthage/Checkouts/CoreStore/CoreStore.xcworkspace" -scheme "CoreStore iOS" -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65: 2016-10-25 22:29:22.006 xcodebuild[31539:2558530] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-11246/IDEFoundation/Playgrounds/IDEPlaygroundAuxiliarySourceCompilerOperation.m:386 Details: Unable to read diagnostics from file "/Users/pavellyskov/Library/Developer/Xcode/DerivedData/CoreStore-bvebbsyydxxrbkhfszeyodbcelke/Build/Intermediates/CoreStore.build/Release-iphoneos/CoreStore iOS.build/Objects-normal/arm64/ObjectMonitor.dia" (Invalid File): Invalid diagnostics signature Function: void XCGenerateDiagnosticsFromFile(NSString _strong, NSString *strong, NSDictionary __strong, NSDictionary strong, IDEActivityLogSectionRecorder *strong, BOOL (^strong)(IDEActivityLogMessage *strong)) Thread: <NSThread: 0x7f7fde855040>{number = 4, name = (null)} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. *_ BUILD FAILED **

The following build commands failed: CompileSwift normal arm64 CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures)

JohnEstropia commented 8 years ago

@Shirk @pointspy The log should have a

*\ xcodebuild output can be found in /var/folders/....

line somewhere that contains the actual xcodebuild compilation errors. Can you send the actual log file?

HealsCodes commented 8 years ago

Here you go: carthage-xcodebuild.log This is for ~> 2.1.0

JohnEstropia commented 8 years ago

@Shirk @pointspy Thanks, I checked both of your logs and it looks like compiler optimizations (-O) break the binary... Are you both running carthage build from a custom build script as instructed here?

(For reference, same issue filed to the Carthage repo: https://github.com/Carthage/Carthage/issues/1359)

HealsCodes commented 8 years ago

No, I still do my carthage build by hand, but I'll give it a try as part of my projects build steps right now!

HealsCodes commented 8 years ago

More updates! Building from a Run Script phase doesn't change the end result. I added a run script phase that simply looks like this:

/usr/local/bin/carthage build

Which does what it says on the tin, but it fails with the same crash and error as if build manually outside the Xcode process: Carthage-inside-XCode crash

Meanwhile I had a look at the Travis builds for CoreStore and they seem to be failing at the same spot.

tmspzz commented 8 years ago

Hi,

current master builds for me in Xcode 8 (swift 2.3) - El Capitan (10.11.6)

Steps:

pointspy commented 8 years ago

How can I install the swift3_develop branch using Cocoapods? Thank you for your help

Hurblat commented 8 years ago

@pointspy you can use the following: pod 'CoreStore', :git => 'https://github.com/JohnEstropia/CoreStore.git', :branch => 'swift3_develop'

pointspy commented 8 years ago

Thanks, @Hurblat! I used Podfile:

platform :iOS target 'iXpenses' do use_frameworks! pod 'CoreStore', :git => 'https://github.com/JohnEstropia/CoreStore.git', :branch => 'swift3_develop' end

And I have the error:

MacBook-Pro-Pavel:iXpenses pavellyskov$ pod install Analyzing dependencies Pre-downloading: CoreStore from https://github.com/JohnEstropia/CoreStore.git, branch swift3_develop [!] Unable to satisfy the following requirements:

Specs satisfying the CoreStore (fromhttps://github.com/JohnEstropia/CoreStore.git, branchswift3_develop) dependency were found, but they required a higher minimum deployment target.

Hurblat commented 8 years ago

What's your deployment target? The podspec requires a minimum of iOS 8.0.

pointspy commented 8 years ago

@Hurblat thank you!

pointspy commented 8 years ago

Hello!

26 окт. 2016 г., в 3:42, John Estropia notifications@github.com написал(а):

@Shirk https://github.com/Shirk @pointspy https://github.com/pointspy The log should have a

*\ xcodebuild output can be found in /var/folders/....

line somewhere that contains the actual xcodebuild compilation errors. Can you send the actual log file?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JohnEstropia/CoreStore/issues/113#issuecomment-256199547, or mute the thread https://github.com/notifications/unsubscribe-auth/AV_foCQvdhYcPbQlgLEZCHDABLAp5jdWks5q3oXdgaJpZM4KcCUR.

HealsCodes commented 8 years ago

@blender looks like Sierra (10.12.1) uses a newer Xcode/swiftc pairing. The current master fails for me with the same errors as the rest.

JohnEstropia commented 8 years ago

@Shirk @pointspy Apologies for the late reply (Asian timezone..)

I've tried different configurations on my machine and the only time I've seen this error is when the Swift toolchain doesn't match the CoreStore branch

Your logs both seem to be using the swift3_develop branch so I am assuming your app project satisfies:

If this is correct, please check that your Xcode->Preferences->Locations->Command Line Tools is set to Xcode 8.0

If you still have problems, please tell your app's Swift version and minimum deployment version.

HealsCodes commented 8 years ago

Don’t worry - I have friends in Singapore I’m used to timezone jumping ^^

My project is targeting Swift 2.3 on a deployment target of iOS 8.0 (building with the 10.0 SDK). I’m using the latest XCode and commandoes tools.

If my log was referring to the swift3_develop branch it could be related to me trying all available branches.

I’ll try to setup a minimal project to reproduce the crash and I’m also trying to upgrade my project to Swift 3 and recheck.

JohnEstropia commented 8 years ago

@Shirk Do you have a way on your side to turn off -O and whole-module-optimization? Checking other sources it looks like this happens when optimizations are turned on and Carthage defaults to Release configuration. If not I'll try to prepare a branch with optimizations turned off

netbe commented 8 years ago

@JohnEstropia so I tried with carthage and get the same error. turning the optimization does work though:

/usr/bin/xcrun xcodebuild -workspace /Users/francois/code/feingoldtech-ios-rest_/Carthage/Checkouts/CoreStore/CoreStore.xcworkspace -scheme "CoreStore iOS" -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES SWIFT_OPTIMIZATION_LEVEL=-O clean build

I don't see a way to pass a build settings in Carthage (SWIFT_OPTIMIZATION_LEVEL=-O) so would it be possible to have an extra configuration or another branch?

Environment: Xcode 8 (swift 2.3) El Capitan (10.11.6) My command line tools is set properly to Xcode 8.

JohnEstropia commented 8 years ago

So according to @blender , turning off whole-module-optimization while keeping -O works. I'll try that now with both the master and swift3_develop branch.

@netbe Can you verify if turning JUST whole-module-optimization off works for you?

JohnEstropia commented 8 years ago

I'll try that now with both the master and swift3_develop branch.

I mean develop and swift3_develop

netbe commented 8 years ago

@JohnEstropia yes it does

JohnEstropia commented 8 years ago

@netbe Thanks! (sorry I didnt scroll through your xcodebuild command far enough)

JohnEstropia commented 8 years ago

Thank you to everyone who helped debug the problem here and over at the slack channel! I turned off whole-module-optimization for the develop and swift3_develop branch. Please try if it works for you (make sure to delete Carthage's cache)

If the develop branch works fine I'll merge to the master branch and update the version tags.

tmspzz commented 8 years ago

@JohnEstropia just confirmed with @netbe (sitting next to me) that on develop (Swift 2.3, Xcode8, ElCapitan 10.11.6) the fix works building with carthage.

JohnEstropia commented 8 years ago

@blender @netbe Thanks!

HealsCodes commented 8 years ago

And another 👍 from me - confirmed fix for develop (Swift 2.3, Xcode8, Sierra 10.12.1) - thanks for all the work in analyzing and working around others bugs!

HealsCodes commented 8 years ago

I think l can get Carthage to build in debug configuration. Worst case l can always change the settings directly. I'll get back to this once l'm back from work.

Sent from my Apple Watch

On 27 Oct 2016, at 10:33 AM, John Estropia notifications@github.com wrote:

@Shirk Do you have a way on your side to turn off -O and whole-module-optimization? Checking other sources it looks like this happens when optimizations are turned on and Carthage defaults to Release configuration. If not I'll try to prepare a branch with optimizations turned off

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

JohnEstropia commented 8 years ago

Closing this issue. If anyone still have problems feel free to request the thread reopened.

Thanks again, everyone! 🎉

zirinisp commented 7 years ago

I had a similar problem and resolved it by removing whole module optimisation. The error appeared after updating from Swift 3.0 to 3.1

Thank you

ghost commented 7 years ago

This worked for me. Turning off the "whole-module-optimization" flag in "Optimization Level" column in Build Settings for "Release" & "Debug" configs i.e. keeping "None[-Onone]" as selection.

Thank you very much for help on this blog.

jantony-ps commented 6 years ago

i had similar issue. But i installed the latest command line tool for Xcode its fixed.