Skip to content

Commit

Permalink
Install llvm-ar in the toolchain and use it by default on Unix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
finagolfin committed Dec 13, 2022
1 parent 0d666e2 commit 9d249c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions lib/Driver/UnixToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,8 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job,

ArgStringList Arguments;

const char *AR;
const char *AR = "llvm-ar";
// Configure the toolchain.
if (getTriple().isAndroid())
AR = "llvm-ar";
else
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
Arguments.push_back("crs");

Arguments.push_back(
Expand Down
4 changes: 2 additions & 2 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ swift-install-components=back-deployment;compiler;clang-builtin-headers;stdlib;s
[preset: mixin_buildbot_install_components_with_clang]

swift-install-components=autolink-driver;back-deployment;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-xpc-service;swift-remote-mirror;swift-remote-mirror-headers
llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;dsymutil;LTO;clang-features-file
llvm-install-components=llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;dsymutil;LTO;clang-features-file

[preset: mixin_buildbot_trunk_base]
# Build standard library and SDK overlay for iOS device and simulator.
Expand Down Expand Up @@ -800,7 +800,7 @@ no-swift-stdlib-assertions
[preset: mixin_linux_install_components_with_clang]

swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc
llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;lld;LTO;clang-features-file
llvm-install-components=llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;lld;LTO;clang-features-file

[preset: mixin_linux_installation]
mixin-preset=
Expand Down
2 changes: 1 addition & 1 deletion utils/build_swift/build_swift/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def llvm_install_components():
"""Convenience function for getting the default llvm install components for
platforms.
"""
components = ['llvm-cov', 'llvm-profdata', 'IndexStore', 'clang',
components = ['llvm-ar', 'llvm-cov', 'llvm-profdata', 'IndexStore', 'clang',
'clang-resource-headers', 'compiler-rt', 'clangd']
if os.sys.platform == 'darwin':
components.extend(['dsymutil'])
Expand Down

0 comments on commit 9d249c7

Please sign in to comment.