Skip to content

Cross compilation incorrectly triggered, resulting in 40-85% build time regression #8275

Open
@MahdiBM

Description

@MahdiBM

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

The original issue is Significant build regressions on swift:6.0-noble compared to 5.10-noble.
The problem described below has the biggest impact in build regressions mentioned in the issue above, but it doesn't cover everything that the issue above was filed for. All those other problems seem to have already been addressed.

It appears when compiling on GHA ubuntu containers and swift images, Swift 6.0's SwiftPM compiles everything twice compared to Swift 5.10's.
The extra builds seem to have -tool added in the object names.

This issue's impact seems to have been multiplied by this other related issue I think(?): #8078
When the double builds are triggered, SwiftPM double builds almost everything instead of at least just double building only what's actually needed in our macros.

Expected behavior

How Swift 5.10 behaves and does not double-compile.

Actual behavior

Double compiles that result in 40% bigger build times in Swift 6.0 compared to 5.10 in smaller machines (that majority of users use, e.g. default GHA machines), or 85% if you use -j.

Steps to reproduce

This issue already took long enough to figure out. I'll see if i find time / mood to put an easy-to-use reproduction project together.

Swift Package Manager version/commit hash

5.10 RELEASE, 6.0.3 RELEASE

Swift & OS version (output of swift --version ; uname -a)

5.10 RELEASE, 6.0.3 RELEASE

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglinuxmore information neededIssue or PR description not sufficientperformancePerformance optimizations and improvementsswift 6.0Related to Swift 6.0 release branchswift buildChanges impacting `swift build`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions