Skip to content

Frontend: correct -sdk search paths for !Darwin #25902

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 3, 2019

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jul 1, 2019

This adjusts the runtime library import paths to add the OS/architecture
subdirectory to the path. This allows the use of -sdk with the
compiler to target Android and Windows as well (and Linux). The SDK
image is identical to that generated by the current CMake setup without
the host tools. Ideally, we would change the layout for the modules on
other targets to be identical to the Darwin layout which converts to
OS//architecture. rather than
OS/architecture/..

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

CC: @jrose-apple @brentdax

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

@swift-ci please test

@jrose-apple
Copy link
Contributor

Shouldn't this just be the architecture and not the platform? The latter should already be part of the SDK, no?

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

Yes, it really should be. However, unfortunately, the current CMake installation image doesn't construct that properly. I want to get that moved over, but couldn't figure out how to make that work. I really want to move the other targets over to the module as a directory approach so that we have the multiple architectures supported.

@beccadax
Copy link
Contributor

beccadax commented Jul 1, 2019

I think we currently treat SDKs on non-Darwin platform as sysroots. Is this going to be compatible with that interpretation? Do we want to install our runtime libraries to platform- and architecture-specific directories on non-Darwin platforms?

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

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

This definitely needs tests before we can merge it.

@jrose-apple
Copy link
Contributor

@compnerd and I have talked a little about the sysroot aspect before, and one of the conclusions was that this is more useful for cross compilation than having to ship an SDK and a resource directory…especially when most of the normal resource directory can be shared.

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

@brentdax - a sysroot doesn't work on all targets. Particularly Windows, the sysroot wont work since there is no concept of sysroot. Android also does not have a sysroot but a set of paths that need to be configured. It seems better to just standardise on this. The SDK here comprises of all the swift pieces that are needed and lets you be agnostic to the root of the system.

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

@brentdax, @jrose-apple Im happy to add a test case for this but I don't see a good way to add a test case for this. Particularly for the case where we are doing cross-compilation.

@jrose-apple
Copy link
Contributor

Maybe you can set up a dummy resource dir and a dummy SDK and then try to get as far as -typecheck?

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

Hmm, wont that try to load the swift module? If so, it would fail, since we cannot have a valid swift module for a foreign target.

@jrose-apple
Copy link
Contributor

jrose-apple commented Jul 1, 2019

-parse-stdlib, maybe? We just need to import some module, and it can come from a swiftinterface now.

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2019

But if you use -parse-stdlib it wont load the standard library right? So, it doesn't test this.

@jrose-apple
Copy link
Contributor

Right, but you can import other things from the same path using normal import.

@compnerd compnerd force-pushed the sdk-on-non-darwin branch from 77b0219 to 725cb48 Compare July 2, 2019 18:20
@compnerd
Copy link
Member Author

compnerd commented Jul 2, 2019

@brentdax @jrose-apple okay, I managed to come up with a tricky test case

@compnerd
Copy link
Member Author

compnerd commented Jul 2, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2019

Build failed
Swift Test Linux Platform
Git Sha - 77b02192d16f0b318c3397615d17a78665e29d1d

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2019

Build failed
Swift Test OS X Platform
Git Sha - 77b02192d16f0b318c3397615d17a78665e29d1d

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Thanks!

@compnerd compnerd force-pushed the sdk-on-non-darwin branch from 725cb48 to d758a9a Compare July 2, 2019 22:30
@compnerd
Copy link
Member Author

compnerd commented Jul 2, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jul 2, 2019

Build failed
Swift Test Linux Platform
Git Sha - d758a9ac8445644eb39bba82433c63cc9a5a318c

@swift-ci
Copy link
Contributor

swift-ci commented Jul 3, 2019

Build failed
Swift Test OS X Platform
Git Sha - d758a9ac8445644eb39bba82433c63cc9a5a318c

@compnerd compnerd force-pushed the sdk-on-non-darwin branch from d758a9a to c2d7918 Compare July 3, 2019 02:20
@compnerd
Copy link
Member Author

compnerd commented Jul 3, 2019

@swift-ci please test and merge

This adjusts the runtime library import paths to add the OS/architecture
subdirectory to the path.  This allows the use of `-sdk` with the
compiler to target Android and Windows as well (and Linux).  The SDK
image is identical to that generated by the current CMake setup without
the host tools.  Ideally, we would change the layout for the modules on
other targets to be identical to the Darwin layout which converts to
OS/<module>/architecture.<extension> rather than
OS/architecture/<module>.<extension>.
@compnerd compnerd force-pushed the sdk-on-non-darwin branch from c2d7918 to f3655ed Compare July 3, 2019 15:40
@compnerd
Copy link
Member Author

compnerd commented Jul 3, 2019

@swift-ci please test and merge

@swift-ci swift-ci merged commit 930699c into swiftlang:master Jul 3, 2019
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