Stream: contributing

Topic: Rust Link time


view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:01):

Does the rust linker take a long time for anyone else?
If I make a small change, recompiling takes a couple of seconds until it hits linking, then it takes well over a minute; probably significantly longer, I haven't actually timed it

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:03):

What OS and CPU architecture are you on?

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:06):

I haven't had it that slow no. I think there's a way to swap the linker using a cargo config file.

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:06):

~/.cargo/config.toml

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:06):

rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=native"]

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:07):

are you doing that already?

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:08):

I'm using WSL

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:09):

I found a comment on a rust blog that using LLVM's linker is faster

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:09):

image.png

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:10):

yes that's what the config I posted does

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:10):

lld is llvm's linker

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:10):

on WSL you need to have all your files in the Linux filesystem rather than Windows or things will be crazy slow. I had that problem when I was first setting up on this project.

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:11):

There are some tips on this in the building_from_source.md or whatever it's called

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:11):

Would it make sense to set lld as the linker in the Cargo files?

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:12):

As far as I know everything is in the Linux filesystem

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:12):

It breaks Wasm

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:12):

wasm uses wasm-ld

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:12):

I don't know if there are other reasons not to use lld

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:12):

That makes sense

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:12):

So I don't actually use that config I just posted because I mainly work on wasm

view this post on Zulip Brian Carroll (Mar 06 2022 at 15:13):

but that's what someone recommended to me so it might help you!

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:14):

I'll give it a try

view this post on Zulip Derek Gustafson (Mar 06 2022 at 15:15):

And looking at the WSL comments in BUILDING_FROM_SOURCE, I'm more sure that that isn't my issue. I cloned the repo from within Linux


Last updated: Jul 05 2025 at 12:14 UTC