tayloraswift / godot-swift

swift language support for the godot game engine
116 stars 5 forks source link

'GodotNativeScriptGenerator' requires macOS 10.10 - Error #3

Open lorenalexm opened 3 years ago

lorenalexm commented 3 years ago

I apologize firstly if this is something that should be common knowledge, I have just not been able to figure it out as of yet. When attempting to build an empty product as per the examples README, I hit a snag when running the SWIFTPM_ENABLE_PLUGINS=1 swift build --product godot-swift-testing -c debug command; as seen below.

error: the executable 'GodotNativeScriptGenerator' requires macos 10.10, but depends on the product 'SwiftPM' which requires macos 10.15; consider changing the executable 'GodotNativeScriptGenerator' to require macos 10.15 or later, or the product 'SwiftPM' to require macos 10.10 or earlier.

I have verified that the suggested Swift development snapshot is active for the directory, though locally not globally.

❯ swiftenv version DEVELOPMENT-SNAPSHOT-2021-06-01-a (set by /Users/lorenalexm/Projects/godot-swift-testing/.swift-version)

My Package.swift file is also barebones, with seemingly nothing out of place or to clutter it up. The directory structure, to keep things simple for my playing around, is as suggested. Hopefully leaving little room for error.

. ├── Package.swift ├── game/ │ ├── project.godot │ └── ... └── swift/ └── ...

// swift-tools-version:5.5
import PackageDescription

let package = Package(
    name: "godot-swift-testing",
    products: [
        .library(name: "godot-swift-testing", type: .dynamic, targets: [ "GodotSwiftTesting"])
    ],
    dependencies: [
        .package(url: "https://github.com/kelvin13/godot-swift/", .branch("master"))
    ],
    targets: [
        .target(name: "GodotSwiftTesting",
            dependencies: [
                .product(name: "GodotNative", package: "godot-swift")
            ],
            path: "swift",
            plugins: [
                .plugin(name: "GodotNativeScript", package: "godot-swift")
            ]
        )
    ]
)

Given the error message it would seem that I would need to define the platforms within the Package.swift of godot-swift as suggested, but that would require a fork of this repo and that just doesn't seem right to me? I am sure it is something small, based on not seeing any other issues related to package plugins and my knowledge to be fairly limited for the subject matter at hand.

Is there something simple I am missing here? I greatly appreciate any insight that can be offered in resolving my issue. Thanks!

alicerunsonfedora commented 3 years ago

It appears that this needs to be included in both godot-swift and your particular package. It seems to be working fine after adding the platforms like below to both Package.swift files:

  platforms: [.macOS(.v10_15), .iOS(.v13)]

I'm wondering if this has consequences, however, and if this causes the game to only work on macOS or iOS. I'm planning to test this by making a web build and seeing if this does anything.

alicerunsonfedora commented 3 years ago

Update: It appears that Float16 is not available on macOS, which causes a problem during build:

(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5533:11: error: 'Float16' is unavailable in macOS
(sub-build) extension Float16:Godot.RectangleElement {}
(sub-build)           ^~~~~~~
(sub-build) Swift.Float16:4:23: note: 'Float16' has been explicitly marked unavailable here
(sub-build) @frozen public struct Float16 {
(sub-build)                       ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:8967:77: warning: redundant same-type constraint 'T' == 'Float32' (aka 'Float')
(sub-build) extension Vector.Plane:Godot.Function.Passable where Storage == SIMD3<T>, T == Float32
(sub-build)                                                                             ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:8967:62: note: same-type constraint 'Storage.Extended.Scalar' == 'Float32' (aka 'Float') implied here
(sub-build) extension Vector.Plane:Godot.Function.Passable where Storage == SIMD3<T>, T == Float32

I'm attaching a log of my latest build for more information. log.txt

lorenalexm commented 3 years ago

I am not able to dig into this until probably this weekend. Just wanted to share from a bit of reading that I found.

It seems that Intel does not have support for the Float16, but the Apple Silicon machines do. So it has been marked as unavailable for any macOS device that is on x86.

That being said, I also found this package which may act as a work around? https://github.com/SusanDoggie/Float16

Again, I have not been at a computer to investigate further. Just making sharing my current rabbit trail.

lorenalexm commented 3 years ago

@alicerunsonfedora I have had a bit of time to spend working on this, and have created a Docker build script to hopefully solve this problem until something can be solved within godot-swift itself. https://github.com/lorenalexm/godot-swift-build-tools

alicerunsonfedora commented 3 years ago

I recently got an M1 Air, so I'm going to see if I can get any farther into the build process using that and the latest toolchain available that supports package plugins (my understanding that package plugins will come to Swift 5.6 instead of 5.5).

alicerunsonfedora commented 3 years ago

Update: It appears that I still get the same Float16 problem, even on the M1:

(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4469:1: error: type 'Float16' does not conform to protocol '_GodotVariantRepresentable'
(sub-build) extension Float16:Godot.VariantRepresentable{}
(sub-build) ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4374:9: note: candidate would match if 'Float16' conformed to 'FixedWidthInteger'
(sub-build)     var variantType:Godot.VariantType
(sub-build)         ^
outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4411:9: note: candidate would match if 'Float16' conformed to 'BinaryFloatingPoint'
(sub-build)     var variantType:Godot.VariantType
(sub-build)         ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4430:9: note: candidate would match if 'Float16' conformed to 'VectorFiniteRangeExpression'
(sub-build)     var variantType:Godot.VariantType
(sub-build)         ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4383:10: note: candidate would match if 'Float16' conformed to 'FixedWidthInteger'
(sub-build)     func takeUnretained(_ value:Godot.Unmanaged.Variant) -> Self?
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4397:10: note: candidate would match if 'Float16' conformed to 'FixedWidthInteger'
(sub-build)     func takeUnretained(_ value:Godot.Unmanaged.Variant) -> Self?
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4416:10: note: candidate would match if 'Float16' conformed to 'BinaryFloatingPoint'
(sub-build)     func takeUnretained(_ value:Godot.Unmanaged.Variant) -> Self?
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4435:10: note: candidate would match if 'Float16' conformed to 'VectorFiniteRangeExpression'
(sub-build)     func takeUnretained(_ value:Godot.Unmanaged.Variant) -> Self?
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4388:10: note: candidate would match if 'Float16' conformed to 'FixedWidthInteger'
(sub-build)     func passRetained() -> Godot.Unmanaged.Variant
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4402:10: note: candidate would match if 'Float16' conformed to 'FixedWidthInteger'
(sub-build)     func passRetained() -> Godot.Unmanaged.Variant
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4421:10: note: candidate would match if 'Float16' conformed to 'BinaryFloatingPoint'
(sub-build)     func passRetained() -> Godot.Unmanaged.Variant
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4444:10: note: candidate would match if 'Float16' conformed to 'VectorFiniteRangeExpression'
(sub-build)     func passRetained() -> Godot.Unmanaged.Variant
(sub-build)          ^
es/GodotSwiftExample/GodotNativeScript/classes.swift:4100:9: note: protocol requires property 'variantType' with type 'Godot.VariantType'; do you want to add a stub?
(sub-build)     var variantType:Godot.VariantType
(sub-build)         ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4139:10: note: protocol requires function 'takeUnretained' with type '(Godot.Unmanaged.Variant) -> Float16?'; do you want to add a stub?
(sub-build)     func takeUnretained(_:Godot.Unmanaged.Variant) -> Self?
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4160:10: note: protocol requires function 'passRetained()' with type '() -> Godot.Unmanaged.Variant'; do you want to add a stub?
(sub-build)     func passRetained() -> Godot.Unmanaged.Variant
(sub-build)          ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4469:11: error: 'Float16' is unavailable in macOS
(sub-build) extension Float16:Godot.VariantRepresentable{}
(sub-build)           ^~~~~~~
(sub-build) Swift.Float16:4:23: note: 'Float16' has been explicitly marked unavailable here
(sub-build) @frozen public struct Float16 {
(sub-build)                       ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4811:78: warning: redundant same-type constraint 'T' == 'Float32' (aka 'Float')
(sub-build) extension Vector.Plane:Godot.Variant            where Storage == SIMD3<T>, T == Float32 {}
(sub-build)                                                                              ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:4811:63: note: same-type constraint 'Storage.Extended.Scalar' == 'Float32' (aka 'Float') implied here
(sub-build) extension Vector.Plane:Godot.Variant            where Storage == SIMD3<T>, T == Float32 {}
(sub-build)                                                               ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5533:1: error: type 'Float16' does not conform to protocol '_GodotRectangleElement'
(sub-build) extension Float16:Godot.RectangleElement {}
(sub-build) ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5533:1: error: type 'Float16' does not conform to protocol '_GodotVectorElement'
(sub-build) extension Float16:Godot.RectangleElement {}
(sub-build) ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5533:1: error: type 'Float16' does not conform to protocol 'SIMDScalar'
(sub-build) extension Float16:Godot.RectangleElement {}
(sub-build) ^
/classes.swift:5481:20: note: protocol requires nested type 'Rectangle2Aggregate'; do you want to add it?
(sub-build)     associatedtype Rectangle2Aggregate:Godot.RawAggregate
(sub-build)                    ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5484:20: note: protocol requires nested type 'Rectangle3Aggregate'; do you want to add it?
(sub-build)     associatedtype Rectangle3Aggregate:Godot.RawAggregate
(sub-build)                    ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5338:20: note: protocol requires nested type 'Vector2Aggregate'; do you want to add it?
(sub-build)     associatedtype Vector2Aggregate:Godot.RawAggregate
(sub-build)                    ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5339:20: note: protocol requires nested type 'Vector3Aggregate'; do you want to add it?
(sub-build)     associatedtype Vector3Aggregate:Godot.RawAggregate
(sub-build)                    ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:5340:20: note: protocol requires nested type 'Vector4Aggregate'; do you want to add it?
(sub-build)     associatedtype Vector4Aggregate:Godot.RawAggregate
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:2:20: note: protocol requires nested type 'SIMDMaskScalar'; do you want to add it?
(sub-build)     associatedtype SIMDMaskScalar : FixedWidthInteger, SIMDScalar, SignedInteger
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:3:20: note: protocol requires nested type 'SIMD2Storage'; do you want to add it?
(sub-build)     associatedtype SIMD2Storage : SIMDStorage where Self.SIMD2Storage.Scalar == Self.SIMD32Storage.Scalar
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:4:20: note: protocol requires nested type 'SIMD4Storage'; do you want to add it?
(sub-build)     associatedtype SIMD4Storage : SIMDStorage where Self.SIMD4Storage.Scalar == Self.SIMD64Storage.Scalar
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:5:20: note: protocol requires nested type 'SIMD8Storage'; do you want to add it?
(sub-build)     associatedtype SIMD8Storage : SIMDStorage
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:6:20: note: protocol requires nested type 'SIMD16Storage'; do you want to add it?
(sub-build)     associatedtype SIMD16Storage : SIMDStorage where Self == Self.SIMD16Storage.Scalar, Self.SIMD16Storage.Scalar == Self.SIMD2Storage.Scalar
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:7:20: note: protocol requires nested type 'SIMD32Storage'; do you want to add it?
(sub-build)     associatedtype SIMD32Storage : SIMDStorage where Self.SIMD32Storage.Scalar == Self.SIMD4Storage.Scalar
(sub-build)                    ^
(sub-build) Swift.SIMDScalar:8:20: note: protocol requires nested type 'SIMD64Storage'; do you want to add it?
(sub-build)     associatedtype SIMD64Storage : SIMDStorage where Self.SIMD64Storage.Scalar == Self.SIMD8Storage.Scalar
(sub-build)                    ^
'Float16' is unavailable in macOS
(sub-build) extension Float16:Godot.RectangleElement {}
(sub-build)           ^~~~~~~
(sub-build) Swift.Float16:4:23: note: 'Float16' has been explicitly marked unavailable here
(sub-build) @frozen public struct Float16 {
(sub-build)                       ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:8967:77: warning: redundant same-type constraint 'T' == 'Float32' (aka 'Float')
(sub-build) extension Vector.Plane:Godot.Function.Passable where Storage == SIMD3<T>, T == Float32
(sub-build)                                                                             ^
(sub-build) /Users/marquis/Developer/godot-swift/examples/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/.build/plugins/outputs/examples/GodotSwiftExample/GodotNativeScript/classes.swift:8967:62: note: same-type constraint 'Storage.Extended.Scalar' == 'Float32' (aka 'Float') implied here
(sub-build) extension Vector.Plane:Godot.Function.Passable where Storage == SIMD3<T>, T == Float32
(sub-build)                                                              ^
(sub-build) [1083/1090] Compiling GodotSwiftExample registration.swift
(sub-build) [1084/1090] Compiling GodotSwiftExample signals.swift
(sub-build) [1085/1090] Compiling GodotSwiftExample life-cycle-management.swift
(sub-build) [1086/1090] Compiling GodotSwiftExample basic-usage.swift
(sub-build) [1087/1090] Compiling GodotSwiftExample custom-types.swift
(sub-build) [1088/1090] Compiling GodotSwiftExample common.swift
(sub-build) [1089/1090] Compiling GodotSwiftExample library.swift
error: sub-build failed
[1078/1080] Generating registration.swift'

Update 1: I'm going to try this again but specifying the arch to arm64 and setting minimum OS version to v11.0.

Update 2: Setting the architecture to arm64 and setting the platform version to .v11_0 did not fix the problem at all. I'm guessing this will not build at all on macOS until Float16 is supported on x86 (so as to mark it available).

alex-dearden commented 2 years ago

Any word on this? I've just ran into this exact problem in April 2022 :)