-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SwiftPM requires librarian to be installed before it can build anything #5761
Comments
This is a bit of a corner case, so no need to revert #5720. We should put some thought into how we handle this though, and do something to at least soften this new requirement before the 5.8 branch. |
We already have the dependency on |
A recent SPM change made it mandatory for there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, so make sure llvm-ar is bundled in the toolchain.
A recent SPM change made it mandatory for there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, so make sure llvm-ar is bundled in the toolchain.
A recent SPM change made it mandatory for there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, so make sure llvm-ar is bundled in the toolchain.
Starting with the latest Dec. 19 trunk snapshot tag, the Swift toolchain now bundles in However, I'd like to use this bundled I'll get on that next month once the CI opens up again, leaving this issue open till then. |
…ld directory Now that llvm-ar is installed by default in the toolchain, swiftlang#62510, and a recent SPM change requires there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, use that bundled llvm-ar for all Unix platforms, which requires copying it over into the build directory too before building the corelibs.
A recent SPM change made it mandatory for there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, so make sure llvm-ar is bundled in the toolchain.
…ld directory Now that llvm-ar is installed by default in the toolchain, swiftlang#62510, and a recent SPM change requires there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, use that bundled llvm-ar for all Unix platforms, which requires copying it over into the build directory too before building the corelibs.
A recent SPM change made it mandatory for there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, so make sure llvm-ar is bundled in the toolchain.
…ld directory Now that llvm-ar is installed by default in the toolchain, swiftlang#62510, and a recent SPM change requires there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, use that bundled llvm-ar for all Unix platforms, which requires copying it over into the build directory too before building the corelibs.
Now that llvm-ar is installed by default in the toolchain, swiftlang/swift#62510, and a recent SPM change requires there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, use that bundled llvm-ar for all Unix platforms.
Description
This was introduced by #5720, which moved detecting the archiver executable from inside of llbuild to SPM. This has always been kind of a mess with SPM, with llbuild always grabbing whatever archiver was in the path. This didn't crop up much unless you were building the rare Swift package that had a static library and happened not to have a binutils package installed in your system.
However, trunk SPM now won't build anything without an archiver included in the Swift toolchain or system path, which is too strict. This is particularly an issue because the Swift toolchain doesn't ship with an archiver: I just checked when debugging this issue and was surprised to find that the official builds don't include
llvm-ar
.The Swift compiler itself is much better on this issue, as you can supply an alternate
-tools-directory
flag where it should look for an archiver, as done for Android. I just ran a variant of that compiler command and confirmed it uses the NDK llvm-ar:However, I see no flag to do the same with SPM, whereas I could always pass the
-tools-directory
I want to SPM with the extra swiftc flags before. With SPM itself checking for an archiver now, it errors before that compiler flag is ever used. I worked around this issue on my Android CI by adding the NDKllvm-ar
to my system path.There are various ways to fix this: my preference would be to start shipping
llvm-ar
with the Swift toolchain and make that the default archiver we use.Expected behavior
Don't require
ar
orllvm-ar
to be installed before building any Swift package, particularly since most won't use it.Actual behavior
error: toolchain is invalid: could not find llvm-ar
Steps to reproduce
I realize that binutils is listed as a dependency of the Swift toolchain on linux, but when cross-compiling for other platforms and supplying your own archiver, as I'm doing for Android, it shouldn't be required that a system archiver be installed.
Swift Package Manager version/commit hash
Tested with the September 5 trunk snapshot
Swift & OS version (output of
swift --version && uname -a
)September 5 trunk snapshot running on Ubuntu 20.04 x86_64
The text was updated successfully, but these errors were encountered: