Use lld by default on linux ()

* Use lld by default on linux

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
This commit is contained in:
Firstyear 2025-02-28 18:30:59 +10:00 committed by GitHub
parent 25c1c1573e
commit e98d60a962
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 22 deletions
.cargo
book/src/developers

11
.cargo/config.toml Normal file
View file

@ -0,0 +1,11 @@
# The default ld from glibc is impossibly slow and consumes huge amounts of
# memory. We use lld by default which often is twice as fast for significantly
# less ram consumption.
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-Ctarget-cpu=native"]
[target.aarch64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-Ctarget-cpu=native"]

View file

@ -100,21 +100,16 @@ You will need [rustup](https://rustup.rs/) to install a Rust toolchain.
### SUSE / OpenSUSE
> NOTE: clang and lld are required to build Kanidm due to performance issues with GCC/ld
You will need to install rustup and our build dependencies with:
```bash
zypper in rustup git libudev-devel sqlite3-devel libopenssl-3-devel libselinux-devel pam-devel systemd-devel tpm2-0-tss-devel
zypper in rustup git libudev-devel sqlite3-devel libopenssl-3-devel libselinux-devel \
pam-devel systemd-devel tpm2-0-tss-devel clang lld make sccache
```
You can then use rustup to complete the setup of the toolchain.
In some cases you may need to build other vendored components, or use an alternate linker. In these
cases we advise you to also install.
```bash
zypper in clang lld make sccache
```
You should also adjust your environment with:
```bash
@ -123,25 +118,16 @@ export CC="sccache /usr/bin/clang"
export CXX="sccache /usr/bin/clang++"
```
And add the following to a cargo config of your choice (such as ~/.cargo/config), adjusting for cpu
arch
```toml
[target.aarch64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-C", "link-arg=-fuse-ld=lld",
]
```
### Fedora
> NOTE: clang and lld are required to build Kanidm due to performance issues with GCC/ld
You will need [rustup](https://rustup.rs/) to install a Rust toolchain.
You will also need some system libraries to build this:
```text
systemd-devel sqlite-devel openssl-devel pam-devel
systemd-devel sqlite-devel openssl-devel pam-devel clang lld
```
Building the Web UI requires additional packages:
@ -152,12 +138,14 @@ perl-FindBin perl-File-Compare
### Ubuntu
> NOTE: clang and lld are required to build Kanidm due to performance issues with GCC/ld
You need [rustup](https://rustup.rs/) to install a Rust toolchain.
You will also need some system libraries to build this, which can be installed by running:
```bash
sudo apt-get install libudev-dev libssl-dev libsystemd-dev pkg-config libpam0g-dev
sudo apt-get install libudev-dev libssl-dev libsystemd-dev pkg-config libpam0g-dev clang lld
```
Tested with Ubuntu 20.04 and 22.04.