about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorxizheyin <xizheyin@smail.nju.edu.cn>2025-03-10 17:36:49 +0800
committerxizheyin <xizheyin@smail.nju.edu.cn>2025-03-10 21:08:25 +0800
commitdc576cb67fcf713de44482a1a5aa586dfeff628e (patch)
tree9453952a7f92043cd86aaba6b055680c5f8b708b /src/doc
parent2c6a12ec44d0426c8939123c2f2cf27d2217de13 (diff)
downloadrust-dc576cb67fcf713de44482a1a5aa586dfeff628e.tar.gz
rust-dc576cb67fcf713de44482a1a5aa586dfeff628e.zip
Add remark for missing llvm-tools component re. rustc_private linker failures related to not finding LLVM libraries
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/language-features/rustc-private.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/rustc-private.md b/src/doc/unstable-book/src/language-features/rustc-private.md
index 3b83a3cf4df..57ed857cdfe 100644
--- a/src/doc/unstable-book/src/language-features/rustc-private.md
+++ b/src/doc/unstable-book/src/language-features/rustc-private.md
@@ -12,3 +12,33 @@ The presence of this feature changes the way the linkage format for dylibs is ca
 that is necessary for linking against dylibs that statically link `std` (such as `rustc_driver`).
 This makes this feature "viral" in linkage; its use in a given crate makes its use required in
 dependent crates which link to it (including integration tests, which are built as separate crates).
+
+## Common linker failures related to missing LLVM libraries
+
+### When using `rustc-private` with Official Toolchains
+
+When using the `rustc_private` feature with official toolchains distributed via rustup, you'll need to install:
+
+1. The `rustc-dev` component (provides compiler libraries)
+2. The `llvm-tools` component (provides LLVM libraries needed for linking)
+
+You can install these components using `rustup`:
+
+```text
+rustup component add rustc-dev llvm-tools
+```
+
+Without the `llvm-tools` component, you may encounter linking errors like:
+
+```text
+error: linking with `cc` failed: exit status: 1
+  |
+  = note: rust-lld: error: unable to find library -lLLVM-{version}
+```
+
+### When using `rustc-private` with Custom Toolchains
+
+For custom-built toolchains or environments not using rustup, different configuration may be required:
+
+- Ensure LLVM libraries are available in your library search paths
+- You might need to configure library paths explicitly depending on your LLVM installation