migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.19k stars 77 forks source link

Difficulty building from "Meet Swift Godot" as well as from fresh `SwiftGodotKick` project #514

Closed JacobSyndeo closed 3 months ago

JacobSyndeo commented 3 months ago

Describe the bug I'm having some trouble compiling when following the "Meet Swift Godot" tutorial, as well as when running make on a fresh SwiftGodotKick project. The same error appears in both cases, specifically:

external macro implementation type 'SwiftGodotMacroLibrary.GodotMacro' could not be found for macro 'Godot'

Suspicious areas of the logs:

Occam's razor has me supposing that the issue is somewhere on my end, but I'm hoping that someone more knowledgeable with SwiftGodot may be able to point me in the right direction here.

To Reproduce Steps to reproduce the behavior: Follow the "Meet Swift Godot" tutorial up to Section 3, Step 4

Expected behavior Successful compilation

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Build log:

swift build
Building for debugging...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build complete! (0.83s)
Building for debugging...
Running with projectDir=$(projectDir) and output=/Users/jacobpritchett/Developer/SimpleRunnerDriver/.build/plugins/outputs/swiftgodot/SwiftGodot/CodeGeneratorPlugin/GeneratedSources
Generator/default_value: no support for [Variant] = 0
Generator/default_value: no support for [Variant] = 0
Generator/default_value: no support for [Variant] = 0
Generator/default_value: no support for [Variant] = 0
Generator/default_value: no support for [typedarray::RDPipelineSpecializationConstant] = Array[RDPipelineSpecializationConstant]([])
Generator/default_value: no support for [typedarray::RDPipelineSpecializationConstant] = Array[RDPipelineSpecializationConstant]([])
error: emit-module command failed with exit code 1 (use -v to see invocation)
rosetta error: Failed to open libRosettaRuntime
 /Users/jacobpritchett/Developer/SimpleRunnerDriver/Sources/SimpleRunnerDriver/PlayerController.swift:12:7: error: external macro implementation type 'SwiftGodotMacroLibrary.GodotMacro' could not be found for macro 'Godot'
class PlayerController: CharacterBody2D {
      ^
/Users/jacobpritchett/Developer/SimpleRunnerDriver/.build/checkouts/SwiftGodot/Sources/SwiftGodot/MacroDefs.swift:22:14: note: 'Godot' declared here
public macro Godot(_ behavior: ClassBehavior = .gameplay) = #externalMacro(module: "SwiftGodotMacroLibrary", type: "GodotMacro")
             ^
/Users/jacobpritchett/Developer/SimpleRunnerDriver/Sources/SimpleRunnerDriver/SimpleRunnerDriver.swift:7:1: error: external macro implementation type 'SwiftGodotMacroLibrary.InitSwiftExtensionMacro' could not be found for macro 'initSwiftExtension(cdecl:types:)'
#initSwiftExtension(cdecl: "swift_entry_point", types: [PlayerController.self])
^
/Users/jacobpritchett/Developer/SimpleRunnerDriver/.build/checkouts/SwiftGodot/Sources/SwiftGodot/MacroDefs.swift:118:14: note: 'initSwiftExtension(cdecl:types:)' declared here
public macro initSwiftExtension(cdecl: String,
             ^
rosetta error: Failed to open libRosettaRuntime
 /Users/jacobpritchett/Developer/SimpleRunnerDriver/Sources/SimpleRunnerDriver/PlayerController.swift:12:7: error: external macro implementation type 'SwiftGodotMacroLibrary.GodotMacro' could not be found for macro 'Godot'
class PlayerController: CharacterBody2D {
      ^
/Users/jacobpritchett/Developer/SimpleRunnerDriver/.build/checkouts/SwiftGodot/Sources/SwiftGodot/MacroDefs.swift:22:14: note: 'Godot' declared here
public macro Godot(_ behavior: ClassBehavior = .gameplay) = #externalMacro(module: "SwiftGodotMacroLibrary", type: "GodotMacro")
             ^
rosetta error: Failed to open libRosettaRuntime
 /Users/jacobpritchett/Developer/SimpleRunnerDriver/Sources/SimpleRunnerDriver/SimpleRunnerDriver.swift:7:1: error: external macro implementation type 'SwiftGodotMacroLibrary.InitSwiftExtensionMacro' could not be found for macro 'initSwiftExtension(cdecl:types:)'
#initSwiftExtension(cdecl: "swift_entry_point", types: [PlayerController.self])
^
/Users/jacobpritchett/Developer/SimpleRunnerDriver/.build/checkouts/SwiftGodot/Sources/SwiftGodot/MacroDefs.swift:118:14: note: 'initSwiftExtension(cdecl:types:)' declared here
public macro initSwiftExtension(cdecl: String,
             ^
error: fatalError

Any help would be greatly appreciated!

migueldeicaza commented 3 months ago

The "Generator/default_value" are just a message for me, it is a reminder that I have to support a handful of additional things.

What is surprising is that you are triggering Rosetta, as this should be a fully native build, I am confused as to how this could end up this way. There should be no need to run Rosetta at all, which would indicate that you have some Intel code being emulated.

JacobSyndeo commented 3 months ago

Went down a bit of a rabbit hole here… as it turns out, that bit in my first message about the Fish shell running via Rosetta was a sign.

Turns out that my Homebrew installation was still x86_64, as I bought and set up this Mac right as Apple Silicon was launched—before Homebrew was ported over for arm64. Running arch returned "i386"… clearly not what it's supposed to say. I'll need to migrate my Homebrew installation now.

In the meantime, I tried on a newer Mac and had no issues, SwiftGodot runs great! 👍🏼

So hopefully this can help anyone else who arrives here via a web search for that Rosetta error: Make sure you're not accidentally using Intel binaries anywhere in the stack—double-check by running arch!

And thanks @migueldeicaza (and other contributors) for building and maintaining this project! You're doing the Swift and Godot communities a great service here; I'm really excited to build with it.