-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Duplication of libLLVM-*.so in the distributed rustc component. #70838
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
cc @cuviper -- you've touched code related to this a bunch recently I think, so maybe would have some time to investigate fixing this. I suspect we want to only ship one LLVM per tarball, at least, though ideally we would only have just the one LLVM library total as well. |
Half-way through writing up this issue I realized the And only if we have to keep both for some odd reason, we'd move it to |
The
I think we may still want the |
Is that... even possible? Is |
Yes it is -- try |
Actually, can you try something like cross-compiling a copy of I suspect that it would actually run just fine on a That is, the result of linking against But maybe I'm missing something. Like running the cross-compiled |
Hmm, I can't actually get cross-builds to work with #![feature(rustc_private)]
extern crate rustc_driver; ... so it would pick that up from the sysroot. Trying to cross-compile i686, I get:
I do have both i686 and x86_64 builds of It works if I just compile native x86_64 though. Then I tried removing the
AFAICS, building normal crates still works fine with that extra In short:
|
Ah, fascinating. What happens if you build such an executable and then remove the |
The final executable still isn't actually linked to LLVM, since it didn't need any of those symbols:
I can run this with |
Okay, it being dependent on |
Oh, |
Move the target libLLVM to rustc-dev For running the compiler, we usually only need LLVM from `$sysroot/lib`, which rustup will make available with `LD_LIBRARY_PATH`. We've also been shipping LLVM in the `$target/lib` directory, which bloats the download and installed size. The one time we do need the latter is for linking `rustc-dev` libraries, so let's move it to that component directly. Here are the dist sizes that I got before and after this change: rust-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz 182M 159M rust-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz 107M 91M rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz 100M 78M rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz 68M 53M rustc-dev-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz 146M 168M rustc-dev-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz 92M 108M The installed size should reduce by exactly one `libLLVM.so` (~70-80M), unless you also install `rustc-dev`, and then it should be identical. Resolves rust-lang#70838.
Since #57286,
libLLVM-*.so
has been distributed in therustc
component in two locations:lib/libLLVM-*.so
(presumably as a runtime dependency ofbin/rustc
)lib/rustlib/$target/lib/libLLVM-*.so
(not sure, maybe for linking custom drivers?)rustc-dev
component, if the duplication can't be avoidedThe difference can be seen in these consecutive nightlies'
rustc
components:libLLVM-*.so
RPATH
bylib/rustlib/$target/codegen-backends/librustc_codegen_llvm-llvm.so
? separate codegen backends are gone, maybe we should just try removing it?All 3 of those
libLLVM-8svn.so
files are identical (even across nightlies, yay for deterministic builds):One fascinating aspect is that the size only increases from
82.22 MiB
to83.18 MiB
, despitelibLLVM-8svn.so
alone being67 MiB
uncompressed, so compression is really helping.Even the
.tar.gz
only goes from111.41 MiB
to113.26 MiB
.(I'm using archive sizes from the 2019-01-06 and 2019-01-07 directory listings in https://static.rust-lang.org/dist, FWIW)
This part of the build system seems relevant, but I'm not sure which of the two this creates:
rust/src/bootstrap/compile.rs
Lines 755 to 757 in 733f104
cc @alexcrichton @rust-lang/release
The text was updated successfully, but these errors were encountered: