Skip to content

[SR-14896] swift build --build-system xcode doesn't respect SWIFT_EXEC #3596

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

Conversation

abertelrud
Copy link
Contributor

When using the xcode build system, SwiftPM isn't passing down the result of overriding SWIFT_EXEC. The same is true for -toolchain and -sdk but this will be fixed in a different PR.

Motivation:

Besides being incorrect and thus a generally something that should be fixed, this also affects SwiftPM CI, where the newly built compiler isn't being used when cross-compilation is active (since SwiftPM currently implements multi-architecture builds by switching build system to use xcbuild).

Modifications:

  • pass down SWIFT_EXEC to xcbuild so it matches what the native build system would have used
  • add a unit test for this

rdar://80194565

@@ -133,20 +131,28 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
supportedArchitectures: [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're in this area, can targetArchitecture also be updated to the host architecture (x86_64 or arm64) instead of hardcoded, if it's readily available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely — there's a whole range of fixes here, but I wanted to parcel them out across a couple of different PRs. This particular one would unblock some CI problems, as alluded to, but I plan to put up another PR that cleans up some of the other hardcoded things here. Also -toolchain and -sdk are not respected, for example.

Copy link
Contributor Author

@abertelrud abertelrud Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put up as a separate PR here: #3597

@abertelrud
Copy link
Contributor Author

I probably need to conditionalize this on macOS before running tests. Marking as WIP until then.

@abertelrud abertelrud marked this pull request as draft July 8, 2021 02:02
@abertelrud abertelrud force-pushed the eng/xcbuild-doesnt-respect-swift_exec branch from 8827104 to 88ec72b Compare July 8, 2021 18:24
@abertelrud abertelrud self-assigned this Jul 8, 2021
@abertelrud abertelrud marked this pull request as ready for review July 8, 2021 18:28
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Jul 8, 2021
…EXEC`

When using the `xcode` build system, SwiftPM isn't passing down the result of overriding SWIFT_EXEC.  The same is true for `-toolchain` and `-sdk` but this will be fixed in a different PR.

Besides being incorrect and thus a generally something that should be fixed, this also affects SwiftPM CI, where the newly built compiler isn't being used when cross-compilation is active (since SwiftPM currently implements multi-architecture builds by switching build system to use xcbuild).

rdar://80194565
@abertelrud abertelrud force-pushed the eng/xcbuild-doesnt-respect-swift_exec branch from 88ec72b to f953c9a Compare July 8, 2021 18:55
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud merged commit 9aab44d into swiftlang:main Jul 8, 2021
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Jul 9, 2021
…SWIFT_EXEC` (swiftlang#3596)

When using the `xcode` build system, SwiftPM isn't passing down the result of overriding SWIFT_EXEC.  The same is true for `-toolchain` and `-sdk` but this will be fixed in a different PR.

Besides being incorrect and thus a generally something that should be fixed, this also affects SwiftPM CI, where the newly built compiler isn't being used when cross-compilation is active (since SwiftPM currently implements multi-architecture builds by switching build system to use xcbuild).

This is the Swift 5.5 nomination of this fix.

rdar://80194565
(cherry picked from commit 9aab44d)
abertelrud added a commit that referenced this pull request Jul 9, 2021
…SWIFT_EXEC` (#3596) (#3600)

When using the `xcode` build system, SwiftPM isn't passing down the result of overriding SWIFT_EXEC.  The same is true for `-toolchain` and `-sdk` but this will be fixed in a different PR.

Besides being incorrect and thus a generally something that should be fixed, this also affects SwiftPM CI, where the newly built compiler isn't being used when cross-compilation is active (since SwiftPM currently implements multi-architecture builds by switching build system to use xcbuild).

This is the Swift 5.5 nomination of this fix.

rdar://80194565
(cherry picked from commit 9aab44d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants