-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Problems with the planned new cross-compilation model #79657
Comments
So I don't think getting rid of the Under the new definition, the I haven't personally lived on the flags yet since we haven't split stuff up and things aren't done cooking in this regard yet, but this will become more important as we split the SDK distribution from the per-platform toolchain monolith that we have today. My eventual goal is to be able to download an Ubuntu sysroot, an Ubuntu Swift SDK, and cross-compile a little CLI application for Ubuntu from my Mac without having to be super clever about it (or whatever OS's we decide to produce Swift SDKs for). I'm not denying that things are probably not working right at the moment, but that's the direction we're trying to push things in.
In this example, |
OK, I thought the plan was to deprecate the flag altogether, but changing the meaning of such a core compilation flag instead is going to be even harder.
Just to be clear, because it is not specified in that new cross-compilation document, will the new model look directly in the specified
It would be nice if whoever is planning this split would write up what files are going to go where and exactly what compiler flags will be used to access them, instead of the vague hand-waving in the current cross-compilation doc.
Sounds great, but the transition process to get there looks rough. I spent some time this weekend investigating how the limited support for an external Supporting such full SDKs is not too important, but I bring it up for two reasons. One is that the plan appears to be in the new cross-compilation model to look for the Swift resource directory in I suggest you take a look at #79621 and the associated swiftlang/swift-driver#1822 and see if that fits your plans for this new cross-compilation model. Both are tiny pulls that keep both old and new cross-compilation models working, while moving the new one laid out in the cross-compilation doc forward. |
Description
@compnerd put together a document on a planned new cross-compilation model last summer, which replaces the flags
-sdk
and-resource-dir
with the flags-sdk
and-sysroot
instead. I've since seen some issues with this new model, in order of importance:-sdk
has a bunch of bugs and doesn't work very well. The most common way to ship Swift core modules and runtime libraries is next to the compiler instead and explicitly specifying an external-resource-dir
works reasonably, though bugs have crept in there too. However, explicitly specifying an external-sdk
, particularly a full SDK that contains both a C/C++ sysroot and a Swift resource directory, has historically been the least used configuration and comes with a lot of bugs.For example, I just saw that the Windows CI tries to build the Foundation macros for the Windows host by using a 6.0.3 Windows SDK with the trunk 6.2 Swift compiler. As explained there, that works fine now because the Swift 6.2 compiler likely quietly ignores the 6.0.3 resource directory in that 6.0.3 SDK and uses the 6.2 stdlib modules next to the compiler instead, but when I enforced that it must use the 6.0.3 SDK alone in that pull, the compile failed as expected. We will need to shake out all such
-sdk
leaks before we can rely on this flag for cross-compilation.-sdk
/-resource-dir
flags look directly in those paths for the C sysroot and Swift runtime resources, but when using-sdk
/-sysroot
instead,-sdk
looks in<sdkPath>/usr/lib/swift
instead for the Swift-specific files. I understand why this was done, for backward compatibility of the-sdk
flag, but this means you cannot specify an arbitrary Swift resource path anymore.For example, when building the compiler tools themselves in this repo, you will often see the flags
-sdk / -resource-dir /home/finagolfin/build/Ninja-Release/swift-linux-aarch64/lib/swift/
used to compile against the system C/C++ sysroot and the freshly-built Swift stdlib. How do you replace that with-sdk
/-sysroot
? We'll probably have to add a third hidden flag-sdk-runtime
that works just like-resource-dir
currently does, if we ever want to remove the-resource-dir
flag from building this repo itself.-sysroot
flag is brand new and barely used, I see a couple bugs in its implementation already. This is easiest to remedy since it's new.Regarding 1., since all current approaches use
-sdk
, we have no choice but to make it better. My in-progress work on making it work properly in #79621 is shaking out more bugs, which I will file and fix as I'm able. At the very least, this suggests we might have to go slower with cross-compilation SDKs while these problems are shaken out.@compnerd, let me know your thoughts.
@al45tair, as PSG chair, maybe you have some input.
@etcwilde, you deal with these cross-compilation issues more than most, thoughts welcome.
@MaxDesiatov, the SDK bundles feature you helped create uses the current
-sdk
/-resource-dir
flags a lot, perhaps you have some input.The text was updated successfully, but these errors were encountered: