Skip to content
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

Switch to LLD linker on Windows by default #15

Closed
2 tasks
repi opened this issue Apr 1, 2019 · 5 comments
Closed
2 tasks

Switch to LLD linker on Windows by default #15

repi opened this issue Apr 1, 2019 · 5 comments
Labels
cargo have-workaround Issues we have / are using a workaround for

Comments

@repi
Copy link
Contributor

repi commented Apr 1, 2019

For our project we find using LLD instead 2x faster for full builds, and 5x faster for incremental builds, compared to the default MSVC linker. This is huge and essential for us, so we enable it manually in .cargo/config:

[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"

It would be nice if this was the default instead on Windows, esp. if it also made it possible to not have to install the Visual Studio Build Tools?

When using LLD Windows we do get this warning, but haven't been an issue for us:

warning: not embedding natvis: lld-link may not support the flag

Related umbrella issue in rust-gamedev WG: rust-gamedev/wg#50

Tracking issue:

@Jake-Shadle
Copy link
Member

Another important aspect of using LLD not just on Windows is that it moves the ecosystem one step closer to doing cross-compilation from other platforms to Windows, while still preserving the aspects people want from native Windows compilation, namely, PDB debugging in eg. Visual Studio.

@repi
Copy link
Contributor Author

repi commented Apr 17, 2019

We have switched to LLD by default now for our main repo as the benefits are so compelling. We enable it with .cargo/config as described above.

This does require that Windows developers also install LLVM to get LLD which is not great but is simple through scoop install llvm. Ideally we would want LLD to eventually be distributed as part of the Rust installation for Windows on stable

@repi repi added the have-workaround Issues we have / are using a workaround for label Apr 17, 2019
@repi repi removed the prio: high label Jun 12, 2019
@repi
Copy link
Contributor Author

repi commented Jun 4, 2020

We've been happily ussing LLD as our only linker on Windows now for over a year without any real problems, and still would like to see it become supported in Rust without having to have full LLVM manually installed. And ideally, eventually, be the default linker on Windows.

Found another tracking issue about this specifically in Rust rust-lang/rust#71520

@repi repi changed the title Switch to LLD linker on Windows Switch to LLD linker on Windows by default May 5, 2021
@repi
Copy link
Contributor Author

repi commented Oct 9, 2021

As this is easy enough to enable in our own workspaces and there is a Rust tracking issue for it, closing this issue on our end.

@repi repi closed this as completed Oct 9, 2021
@frederikhors
Copy link

I'm on Windows 10 x64 with:
rustup 1.25.1 (bb60b1e89 2022-07-12)
rustc 1.66.1 (90743e729 2023-01-10)
MSVC v143 installed with Visual Studio Installer from Microsoft.

If I open a Rust project and change a simple char in code (eg: a variable value from 1 to 2) it re-builds the project (using watchexec) in 12 seconds.

I installed llvm and used this in global cargo config file (C:/Users/<username>/.cargo/config)

[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"

After a cargo clean and an initial re-build (debug mode, 2 minutes, the same as without lld) the time is the same (maybe even worse than 1 second).

So no change with or without LLD.

Can you confirm or am I wrong?

How to get faster incremental (development) builds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cargo have-workaround Issues we have / are using a workaround for
Projects
None yet
Development

No branches or pull requests

3 participants