Skip to content

2.0.0-beta.2: build tool plugins fail on Linux, the plugin's executable is never built #480

Done

Description

@gulian

Description

On Linux, xtool dev build with 2.0.0-beta.2 fails for any package that uses a build tool plugin backed by an executable target. 1.24 (and current main) build the same package fine.

Minimal package (five files):

// Package.swift
// swift-tools-version: 6.0
import PackageDescription

let package = Package(
    name: "Repro",
    platforms: [.iOS(.v17)],
    products: [.library(name: "ReproApp", targets: ["ReproApp"])],
    targets: [
        .executableTarget(name: "Gen"),
        .plugin(name: "GenPlugin", capability: .buildTool(), dependencies: ["Gen"]),
        .target(name: "ReproApp", plugins: ["GenPlugin"]),
    ]
)
// Sources/Gen/main.swift
import Foundation

let output = CommandLine.arguments[1]
try "let generatedGreeting = \"hello\"\n".write(toFile: output, atomically: true, encoding: .utf8)
// Plugins/GenPlugin/plugin.swift
import PackagePlugin

@main
struct GenPlugin: BuildToolPlugin {
    func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
        let output = context.pluginWorkDirectoryURL.appending(path: "Generated.swift")
        return [
            .buildCommand(
                displayName: "Generate Generated.swift",
                executable: try context.tool(named: "Gen").url,
                arguments: [output.path],
                outputFiles: [output]
            ),
        ]
    }
}

plus a SwiftUI @main app in Sources/ReproApp/ that prints generatedGreeting, and an xtool.yml with product: ReproApp.

Result:

error: Build input file cannot be found: '…/.build/out/Products/Debug-linux-x86_64/Gen'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

The host tool is expected under Debug-linux-x86_64, but nothing builds it there. Real-world case: SwiftTerm's SwiftTermBuildInfoPlugin, so any app depending on SwiftTerm fails the same way.

Environment

Host OS (macOS/Linux/WSL): Linux

Host OS version: Ubuntu 26.04.1 LTS, x86_64

iOS device version: not relevant, the build fails before anything is installed

Swift version: 6.4.1 (swift-6.4.1-RELEASE)

SDK version: iPhoneOS27.2.sdk, from Xcode 27.2, installed by xtool 2.0.0-beta.2

xtool version: 2.0.0-beta.2 (x86_64 AppImage)

Activity

  1. added a commit that references this issue on Nov 28, 2026
    c55aabf
  2. kabiroberai commented on Nov 28, 2026

    @kabiroberai
    Member

    Fixed by #481!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions