Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remark for missing llvm-tools component re. rustc_private linker failures related to not finding LLVM libraries #137931

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/doc/unstable-book/src/language-features/rustc-private.md
Original file line number Diff line number Diff line change
@@ -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