-
Notifications
You must be signed in to change notification settings - Fork 195
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
This driver no longer looks in a passed-in -sdk
for the Swift modules and libraries
#1562
Comments
Alright, spent a couple hours looking into this, looks to me like a long-standing latent bug in the Some background first: the legacy C++ Driver has long had a This new swift-driver has no such method and simply delegates finding the Swift resource directory to the I was surprised that the
It gets to the link step before failing, this suggests the
To hammer the point home, let's use the new
This passes the
To sum up, the old C++ Driver always looked in Now that we're starting to ship cross-compilation SDK bundles that may have such full platform SDKs, we should close this hole up. It will need to be fixed in the Pinging @artemcm and @DougGregor on how I should fix this, since you guys wrote some of the relevant logic, and @compnerd and @MaxDesiatov, since this fix will affect your work on Windows and SDK bundles. Since this bug was never noticed this long, I figure the fix won't break anything, but this will affect all toolchains, so I want to run it by you all. |
Thanks for the investigation @finagolfin. Moreover, it would be tough to implement this logic in the new driver since the target info is queried when the target triple is not known to the driver yet, relying on the target info query to yield the default host triple when one is not specified to the compilation. Potentially something like this could work, but I will need to do more testing on it: |
@compnerd and some Windows devs have been trying out Android cross-compilation from Windows, and in response to some issues they've been seeing, I suggested symlinking the Swift files into the C sysroot in the Android NDK. I then tried it myself on linux, using my Android SDK for Swift for convenience, and found that it works with the legacy C++ Driver, but not this one:
Note how the old C++ driver correctly passes
-Landroid-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/swift/android
to the linker, while this swift-driver incorrectly passes a non-existent-L /home/fina/swift-5.9.2-RELEASE-ubi9/usr/lib/swift/android
to the linker and strangely also-resource-dir /home/fina/swift-5.9.2-RELEASE-ubi9/usr/lib/swift
to the frontend.At the very least, we should resolve this discrepancy between the two drivers, which was probably not noticed because nobody is distributing full Unix cross-compilation SDKs, ie a single platform SDK containing both a C/C++ sysroot and Swift libraries, not bundled with the toolchain.
The text was updated successfully, but these errors were encountered: