Skip to content

SwiftCompilerPlugin' was created for incompatible target arm64-apple-macos10.15 #12

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

Open
kingnight opened this issue Jan 9, 2025 · 3 comments

Comments

@kingnight
Copy link

hi, thanks your good job to create swift-syntax-xcframeworks

  1. I downloaded swift-syntax-xcframeworks framework as local
  2. create package to write macro as following
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
import CompilerPluginSupport

let package = Package(
    name: "Singleton",
    platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .macCatalyst(.v13)],
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "Singleton",
            targets: ["Singleton"]
        ),
        .executable(
            name: "SingletonClient",
            targets: ["SingletonClient"]
        ),
    ],
    dependencies: [
        // Depend on the Swift 5.9 release of SwiftSyntax
//        .package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.0"),
//        .package(name: "swift-syntax-xcframeworks", path: "./SwiftSyntaxWrapper"),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        // Macro implementation that performs the source transformation of a macro.
        .binaryTarget(name: "swift-syntax-xcframeworks", path: "./SwiftSyntaxWrapper"),
        .macro(
            name: "SingletonMacros",
            dependencies: [
//                .product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
//                .product(name: "SwiftCompilerPlugin", package: "swift-syntax")
                .product(name: "SwiftSyntaxWrapper", package: "swift-syntax-xcframeworks"),
            ]
        ),

        // Library that exposes a macro as part of its API, which is used in client programs.
        .target(name: "Singleton", dependencies: ["SingletonMacros"]),

        // A client of the library, which is able to use the macro in its own code.
        .executableTarget(name: "SingletonClient", dependencies: ["Singleton"]),

        // A test target used to develop the macro implementation.
        .testTarget(
            name: "SingletonTests",
            dependencies: [
                "SingletonMacros",
//                .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
                .product(name: "SwiftSyntaxWrapper", package: "swift-syntax-xcframeworks"),
            ]
        ),
    ]
)

  1. build package with Xcode16.0
    Error:

/Users/kaijin/Documents/iOS/Swift/SwiftMacro/Singleton/Sources/SingletonMacros/SingletonMacro.swift:1:8: Module 'SwiftCompilerPlugin' was created for incompatible target arm64-apple-macos10.15: /Users/kaijin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/SwiftCompilerPlugin-2Q99KEHNKDM9V.swiftmodule

@ssly1997
Copy link

This framework only supports Mac for arm64. Your Mac is likely based on x86.

@kingnight
Copy link
Author

@ssly1997 thanks for your advice, i will try it

@ssly1997
Copy link

ssly1997 commented Mar 6, 2025

@sjavora could u support x86_64 like this:

#if arch(arm64)
let SwiftSyntaxWrapper = Target.binaryTarget(xxx)
#else
let SwiftSyntaxWrapper = Target.binaryTarget(xxx)
#endif

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

2 participants