Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compiling in Xcode 11 #32

Closed
eX-innovation opened this issue Dec 16, 2019 · 6 comments
Closed

Not compiling in Xcode 11 #32

eX-innovation opened this issue Dec 16, 2019 · 6 comments

Comments

@eX-innovation
Copy link

Hello!

I just wanted to use Graphiti in my project, but the compiler throws a 'Segmentation fault: 11', when populating the 'Schema' with more than one 'Field' in a 'Type' or when adding a 'Query'.

While troubleshooting I forked and cloned Graphiti itself.
The compiler threw the same error, because of the Schema in the StarWarsTests.
As I removed all tests from the Graphiti project, the project could compile.

Has anyone experienced the same behaviours before?
Tried on two different machines with Xcode 11.2.1, 11.3 and Swift 5.1.2, 5.1.3

Regards,
Michael

@noahemmet
Copy link
Contributor

noahemmet commented Jan 7, 2020

I'm running into this myself after updating to the latest Graphiti—you can reproduce it in this file, taken mostly from the example in the README (plus a few Codable conformances): https://github.com/SwiftGraphQLExample/Server-Vapor/blob/master/Sources/App/Data/Schema.swift

This feels like a Swift @functionBuilder type-checking bug (I'm using Xcode 13), but you can build it successfully if you comment everything out except, say, the Episode enum and one of its values.

In case it means anything to you, here's the stack dump I get after running swift build:

0  swift                    0x0000000107756a63 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x0000000107756236 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff66eadb1d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2568299776
4  swift                    0x00000001037f1aab swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*, bool) + 1755
5  swift                    0x00000001037f3d7b swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 91
6  swift                    0x0000000103830e31 swift::Lowering::SILGenModule::emitGlobalInitialization(swift::PatternBindingDecl*, unsigned int) + 2417
7  swift                    0x000000010379d370 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 752
8  swift                    0x000000010379c316 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1238
9  swift                    0x000000010379dd76 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1238
10 swift                    0x000000010339f974 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 28340
11 swift                    0x00000001033952b4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
12 swift                    0x00000001033227b3 main + 1219
13 libdyld.dylib            0x00007fff66cac405 start + 1
14 libdyld.dylib            0x0000000000000064 start + 2570402912


Edit: Looks like there are a couple of open related-ish bugs over at the Swift bug tracker https://bugs.swift.org/browse/SR-11888?jql=text%20~%20%22functionbuilder%22. The TLDR is that this may be a regression, with a fix on master, so maybe we'll see it in the next Xcode/Swift release?

@noahemmet
Copy link
Contributor

Update: Looks like this is still a problem as of the January 7th master and 5.2 nightlies.

@MihaelIsaev
Copy link

MihaelIsaev commented Jan 21, 2020

@noahemmet

I'm using Xcode 13

Could you share where to download Xcode 13? 😮

@eX-innovation
Copy link
Author

The most recent Xcode version is 11.3.1 and available on the AppStore.

@alexsteinerde
Copy link
Member

I created a fork that gets rid of the function builders as long as they are in a "beta" and private state. I think the long term solution should be function builders but until then you can try this fork: https://github.com/alexsteinerde/Graphiti

@paulofaria
Copy link
Member

This is fixed in the last release. Unfortunately we had to go back to more verbose conventional builders. We could also provide the array solution @alexsteinerde used in parallel, I reckon. Let people choose what they prefer. I'm still not sure which I prefer myself, to be honest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants