-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Trunk 6.1 Macro builds appear to incorrectly compile all package dependencies also for the host when cross-compiling? #8078
Comments
I just tried to reproduce using the official 6.0.1 toolchain for linux with the 6.0.1 Musl SDK bundle and my 6.0.1 Android SDK bundle, but could not. It appears this is a regression in trunk 6.1. Pinging @MaxDesiatov and @xedin, who worked on getting macros working when cross-compiling during the summer. |
I'm able to reproduce this bug with the latest Sep. 25 trunk snapshot of the official Musl SDK bundle too:
|
I just ran into this in another context. SwiftPM elevates all executables to be products, even those used by build plugins. I'll need to double check if this applies to macros (which are actually executables in the end). I guess I get why this was done since people wanted to make sure they can run executables even if they aren't declared products? But it definitely causes build pain for executables you don't want to run. |
That sounds like it has always been the case? Whereas this is a recent regression, as Swift 6.0 fixed building macros when cross-compiling a package, #6950, and it doesn't have this excessive compilation bug, only trunk 6.1 does. |
A lot of that code has been "adjusted" recently. At any rate, again, not sure about macros, but I'm definitely seeing it on main with plugin tools. |
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
I just tried cross-compiling swift-foundation for Android AArch64 using a recent trunk 6.1 Oct. 8 snapshot bundle generated by my daily Android CI. While the command below built fine, I noticed it was building a lot of files, and was surprised to find it was building FoundationICU twice, once for the linux x86_64 host and then again for the Android AArch64 target! This appears to be a SwiftPM bug, as I see no reason to build these swift-foundation dependencies like swift-collections and swift-foundation-icu for the host too:
I saw this for the first time months ago,
so it should be reproducible with Swift 6.0.1 also.Expected behavior
Only build the Foundation macros for the linux x86_64 host.
Actual behavior
All package dependencies appear to be compiled twice, whether they're used by the macros or not.
Steps to reproduce
Swift Package Manager version/commit hash
Definitely the Oct. 8 6.1 snapshot,
probably the 6.0 release alsoSwift & OS version (output of
swift --version ; uname -a
)Swift 6.1 cross-compiling from Fedora 40 x86_64 to Android AArch64
The text was updated successfully, but these errors were encountered: