-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Don't add Toolchain.toolchainLibDir to the list of directories SwiftPM links against #6767
Comments
Looks like this was about SwiftSyntax, so might generally not be needed anymore. |
Specifically this is said in the radar:
I'm not sure if that's ever desirable anymore tbh. |
@neonichu, should I go ahead and submit a pull to remove that library lookup? Do you still need it on Darwin platforms? |
…to look up libraries for target triple Also, update my github username in the mailmap. Resolves swiftlang#6767
…to look up libraries for target triple (swiftlang#6824) Also, update my github username in the mailmap. Resolves swiftlang#6767
…to look up libraries for target triple (swiftlang#6824) Also, update my github username in the mailmap. Resolves swiftlang#6767
Description
I recently reorganized the Swift package for the Termux app, so that the Swift runtime libraries for the host are placed in
<sysroot>/usr/lib/
, not in<sysroot>/usr/lib/swift/android/
. This caused issues when cross-compiling, because SwiftPM sets atoolchainLibDir
relative to the Swift compiler, which is then used to search for libraries to link against.This was added by Ankit in #2035 several years ago and is incorrect when cross-compiling, as most platforms don't use fat binaries that can all be placed in a single directory. I don't know why it was added, as I don't have access to that rdar.
This caused an issue for me as the linker would find the host runtime libraries for Swift in
<sysroot>/usr/lib/
and complain, rather than using the ones in the cross-compilation SDK I provided. I've since reverted this library lookup in the Termux package for Swift, termux/termux-packages@222274616, and cross-compilation works well again.This currently does not affect the official toolchains only because they place no Swift runtime libraries in
<sysroot>/usr/lib/
, placing everything in<sysroot>/usr/lib/swift/<os>/<arch>?
instead. However, some distros have Swift packages and reorganize where they put things, and @etcwilde has said that he'd like to see them normalize where they place these Swift host runtime libraries, ie in<sysroot>/usr/lib/
instead. That will break cross-compilation with SwiftPM, as it has for me in Termux.Expected behavior
Cross-compilation to only look in the SDK provided
Actual behavior
It looks in
<sysroot>/usr/bin/swiftc/../../lib/
too.Steps to reproduce
<sysroot>/usr/lib/
.Swift Package Manager version/commit hash
5.8
Swift & OS version (output of
swift --version ; uname -a
)5.8
All ELF platforms, probably Windows too
The text was updated successfully, but these errors were encountered: