Skip to content

Commit adb94ce

Browse files
committed
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>
1 parent 2c6a12e commit adb94ce

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/doc/unstable-book/src/language-features/rustc-private.md

+30
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,33 @@ The presence of this feature changes the way the linkage format for dylibs is ca
1212
that is necessary for linking against dylibs that statically link `std` (such as `rustc_driver`).
1313
This makes this feature "viral" in linkage; its use in a given crate makes its use required in
1414
dependent crates which link to it (including integration tests, which are built as separate crates).
15+
16+
## Common linker failures related to missing LLVM libraries
17+
18+
### When using `rustc-private` with Official Toolchains
19+
20+
When using the `rustc_private` feature with official toolchains distributed via rustup, you'll need to install:
21+
22+
1. The `rustc-dev` component (provides compiler libraries)
23+
2. The `llvm-tools` component (provides LLVM libraries needed for linking)
24+
25+
You can install these components using `rustup`:
26+
27+
```
28+
rustup component add rustc-dev llvm-tools
29+
```
30+
31+
Without the `llvm-tools` component, you may encounter linking errors like:
32+
33+
```
34+
error: linking with `cc` failed: exit status: 1
35+
|
36+
= note: rust-lld: error: unable to find library -lLLVM-{version}
37+
```
38+
39+
### When using `rustc-private` with Custom Toolchains
40+
41+
For custom-built toolchains or environments not using rustup, different configuration may be required:
42+
43+
- Ensure LLVM libraries are available in your library search paths
44+
- You might need to configure library paths explicitly depending on your LLVM installation

0 commit comments

Comments
 (0)