Skip to content

Pass toolchainLibDir if using XCBuild #3695

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 2 commits into from
Aug 29, 2021

Conversation

neonichu
Copy link
Contributor

We pass this as an additional -L when building with SwiftPM's own build system, so we should also pass this when using XCBuild.

rdar://82313817

We pass this as an additional `-L` when building with SwiftPM's own build system, so we should also pass this when using XCBuild.

rdar://82313817
@neonichu
Copy link
Contributor Author

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

Going the same route as how we are passing SWIFT_EXEC here, another option would be setting it in the PIF itself.

@abertelrud
Copy link
Contributor

Looks good to me, and is similar to the SWIFT_EXEC that had to be added recently (the line above the one you added).

Are there other settings that we need to pass as well, of a similar ilk?

Also, are there any meaningful unit tests that can be added here? I added one for SWIFT_EXEC I think, maybe it can be extended.

@neonichu
Copy link
Contributor Author

It looks like there are a few more settings which could be interesting:

  • macosSwiftStdlib which gets passed passed to executables and tests on Darwin in the SwiftPM build system, so we should pass that via the PIF
  • getClangCompiler() which we should probably also pass here
  • extraCCFlags, extraSwiftCFlags and extraCPPFlags which I am not sure about whether we should pass them as overrides here or via the PIF

@neonichu
Copy link
Contributor Author

16:05:21 Test Case 'APIDiffTests.testCheckVendedModulesOnly' started at 2021-08-27 18:03:56.638
16:05:21
/home/buildnode/jenkins/workspace/swift-package-manager-self-hosted-Linux-smoke-test/branch-main/swiftpm/Tests/CommandsTests/APIDiffTests.swift:144: error: APIDiffTests.testCheckVendedModulesOnly : XCTAssertTrue failed -
16:05:21 Test Case 'APIDiffTests.testCheckVendedModulesOnly' failed (21.405 seconds)

This doesn't look related.

@DougGregor
Copy link
Member

I rudely committed my changes to see if everything will build together

@DougGregor
Copy link
Member

@swift-ci please test

@DougGregor
Copy link
Member

@swift-ci please smoke test

@DougGregor
Copy link
Member

Since this change unblocks work on back-deploying concurrency, I'm going to go ahead and merge.

@DougGregor DougGregor merged commit c115e14 into main Aug 29, 2021
@DougGregor DougGregor deleted the pass-toolchain-library-path-to-xcbuild branch August 29, 2021 04:45
@tomerd
Copy link
Contributor

tomerd commented Aug 30, 2021

Since this change unblocks work on back-deploying concurrency, I'm going to go ahead and merge.

@DougGregor

=> lets circle back to @neonichu above: #3695 (comment)

=> should adding this path also apply outside the context of XCBuild? ie when you using swift build on a mac we would want the same behavior, no?

=> finally, buildParameters.toolchain.toolchainLibDir points to where SwiftPM places its dylibs used to provide the manifest and plugins "scripts" APIs. What would create these new swift/macosx subdirectories and place libraries there

cc @abertelrud

@neonichu
Copy link
Contributor Author

SwiftPM's build system already passes all these, it's just missing from builds with XCBuild as the build system.

I believe the libraries in swift/macosx get created by the compiler itself, e.g. this is where compatibility libraries end up (which initially spawned this PR).

@tomerd
Copy link
Contributor

tomerd commented Aug 30, 2021

I believe the libraries in swift/macosx get created by the compiler itself, e.g. this is where compatibility libraries end up (which initially spawned this PR).

got it, is it new?

@DougGregor
Copy link
Member

I believe the libraries in swift/macosx get created by the compiler itself, e.g. this is where compatibility libraries end up (which initially spawned this PR).

got it, is it new?

No, it is not new, but the set of compatibility libraries hasn't changed since Swift 5.1, which (I think) predates the introduction of this code path. The SwiftPM path gets it for free because the Swift driver is responsible for forming the link line, not XCBuild.

neonichu added a commit that referenced this pull request Sep 2, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
neonichu added a commit that referenced this pull request Sep 3, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
neonichu added a commit that referenced this pull request Sep 3, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
neonichu added a commit that referenced this pull request Sep 7, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
neonichu added a commit that referenced this pull request Sep 8, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
neonichu added a commit that referenced this pull request Sep 8, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817

(cherry picked from commit 329da56)
neonichu added a commit that referenced this pull request Sep 8, 2021
This is a follow-up to #3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817

(cherry picked from commit 329da56)
mattt pushed a commit to mattt/swift-package-manager that referenced this pull request Sep 16, 2021
This is a follow-up to swiftlang#3695, adding various other settings of the toolchain that we weren't yet correctly forwarding when XCBuild is being used.

rdar://82313817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants