Linker for Rust

Hello! I would like to contact the developers. I recently learned that Rust uses the C / C ++ linker, I would very much like Rust's native compiler to come with its own linker and not use a third-party C / C ++ linker, since it is not always convenient to download third-party software during the installation process.

1 Like

This is a recommendation and wish to the Rust development team. This idea is supported by me and my colleagues. I would like to see this fix in future versions of Rust.

There are already efforts ongoing to switch to LLVM's standalone linker (LLD) on some platforms.

Though it is worth mentioning that, at least on Windows, other stuff like the C runtime also comes from MSVC, so switching linkers wouldn't totally get rid of the dependency on third party stuff.

Also on Linux Rust depends on the POSIX standard libraries (and similar on other unixes), which only the system compiler knows how to find, if you look at Use lld by default on x64 Ubuntu 20.04 LTS · Issue #71515 · rust-lang/rust · GitHub you'll see that the plan is to invoke lld via gcc as that is the system compiler for Ubuntu and can pass the required arguments to find the system libraries. If you want to remove this requirement you probably have to go a level higher and talk to the OS maintainers to provide some way to find these without using a C compiler.

6 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.