-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Link LLVM tools dynamically #43577
Link LLVM tools dynamically #43577
Conversation
Set `LLVM_LINK_LLVM_DYLIB=ON` -- "If enabled, tools will be linked with the libLLVM shared library." Rust doesn't ship any of the LLVM tools, and only needs a few at all for some test cases, so statically linking the tools is just a waste of space. I've also had memory issues on slower machines with LLVM debuginfo enabled, when several tools start linking in parallel consuming several GBs each. With the default configuration, `build/x86_64-unknown-linux-gnu/llvm` was 1.5GB before, now down to 731MB. The difference is more drastic with `--enable-llvm-release-debuginfo`, from 28GB to "only" 13GB. This does not change the linking behavior of `rustc_llvm`.
(rust_highfive has picked a reviewer for you, use r? to override) |
I'm curious what's the use case for this. There's already an option to set llvm-root. The rustup binaries needs to be linked statically. Shared libraries can cause path conflicts too. |
The use case is to reduce the resource requirements for building rustc's own LLVM. When several of the LLVM tools link in parallel, especially with debuginfo enabled, it takes a LOT of memory. The resulting binaries also take a lot of disk space. The LLVM tools are not shipped with rustc at all, so it's fine for them to just link to a locally-built libLLVM.so instead.
I assume you mean the binaries distributed through rustup. They still are static -- this is why I mentioned that there's no change for |
This seems to be a clear win. @bors r+ |
📌 Commit 1636a2c has been approved by |
⌛ Testing commit 1636a2c with merge a04aa70b0ddb81f12cc46946aa406a706cbff007... |
💔 Test failed - status-appveyor |
Failed to link LLVM products on MSVC. Legit
|
That's annoying... it failed within the LLVM build. I'm tempted to just skip this flag on Windows, leaving it to the status quo, but I'll do a little research first. |
Alright, I think that setting is just buggy on Windows, so I've excluded it from this change for now. Let's see if the rest of the platforms can handle it, otherwise I'll set it on Linux only. |
@bors r+ |
📌 Commit ced1fda has been approved by |
⌛ Testing commit ced1fda with merge 157267418be3397b0627227a6f35675a6224fd67... |
💔 Test failed - status-travis |
|
Sheesh. OK, I have experience with linux-gnu, and it looks like apple-darwin was OK, so let's just try those. |
The third time is the charm! @bors r+ |
📌 Commit 6c46f4f has been approved by |
⌛ Testing commit 6c46f4f with merge 08f0680f3c414c9b54502a7776c77239a4bb26cd... |
💔 Test failed - status-appveyor |
@bors retry #42117 —
|
Link LLVM tools dynamically Set `LLVM_LINK_LLVM_DYLIB=ON` -- "If enabled, tools will be linked with the libLLVM shared library." Rust doesn't ship any of the LLVM tools, and only needs a few at all for some test cases, so statically linking the tools is just a waste of space. I've also had memory issues on slower machines with LLVM debuginfo enabled, when several tools start linking in parallel consuming several GBs each. With the default configuration, `build/x86_64-unknown-linux-gnu/llvm` was 1.5GB before, now down to 731MB. The difference is more drastic with `--enable-llvm-release-debuginfo`, from 28GB to "only" 13GB. This does not change the linking behavior of `rustc_llvm`.
☀️ Test successful - status-appveyor, status-travis |
Whew, thanks! |
Set
LLVM_LINK_LLVM_DYLIB=ON
-- "If enabled, tools will be linked withthe libLLVM shared library." Rust doesn't ship any of the LLVM tools,
and only needs a few at all for some test cases, so statically linking
the tools is just a waste of space. I've also had memory issues on
slower machines with LLVM debuginfo enabled, when several tools start
linking in parallel consuming several GBs each.
With the default configuration,
build/x86_64-unknown-linux-gnu/llvm
was 1.5GB before, now down to 731MB. The difference is more drastic
with
--enable-llvm-release-debuginfo
, from 28GB to "only" 13GB.This does not change the linking behavior of
rustc_llvm
.