Skip to content

[6.0] Fix host/target products with --static-swift-stdlib #7743

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

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Jul 2, 2024

Cherry-pick of #7695.

Explanation: Given the following conditions:

  • --static-swift-stdlib is enabled (it only affects "target" destination products, "host" destination products are always dynamic)
  • the building subset contains both "host" and "target" destination products derived from the same product.
  • the product imports Foundation (that has private dependency libs)

then the build randomly failed due to the race condition of the Objects.LinkFileList creation.

Reproducible project
https://github.com/kateinoigakukun/swift-autolink-issue-repro

Scope: isolated to packages with plugins
Risk: low, the change was incubated on main for a few weeks now
Testing: Added a new automated test case
Issue: N/A
Reviewer: @MaxDesiatov

…dlib` (#7695)

### Motivation:

Given the following conditions:
- `--static-swift-stdlib` is enabled (it only affects "target"
destination products, "host" destination products are always dynamic)
- the building subset contains both "host" and "target" destination
products derived from the same product.
- the product imports `Foundation` (that has private dependency libs)

then the build randomly failed due to the race condition of the
Objects.LinkFileList creation.

Reproducible project
https://github.com/kateinoigakukun/swift-autolink-issue-repro

### Modifications:

This commit fixes the issue by distinguishing the temporary link file
list response file name by the `-tool` suffix.

I think it would be better to add assertions in `LLBuildManifest` to
avoid such unintentional target overwrites later.

### Result:

Fix the build for the above case.

(cherry picked from commit e858647)
@MaxDesiatov MaxDesiatov added bug plugins cross-compilation swift 6.0 Related to Swift 6.0 release branch labels Jul 2, 2024
@MaxDesiatov MaxDesiatov self-assigned this Jul 2, 2024
@MaxDesiatov MaxDesiatov requested a review from a team as a code owner July 2, 2024 14:24
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov removed their assignment Jul 2, 2024
@MaxDesiatov MaxDesiatov enabled auto-merge (squash) July 2, 2024 15:41
@MaxDesiatov MaxDesiatov merged commit e988969 into release/6.0 Jul 2, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/6.0-autolink-issue branch July 2, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cross-compilation plugins swift 6.0 Related to Swift 6.0 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants