File: E0462.md

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (32 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Found `staticlib` `..` instead of `rlib` or `dylib`.

Consider the following two files:

`a.rs`
```ignore (cannot-link-with-other-tests)
#![crate_type = "staticlib"]

fn foo() {}
```

`main.rs`
```ignore (cannot-link-with-other-tests)
extern crate a;

fn main() {
    a::foo();
}
```

Crate `a` is compiled as a `staticlib`. A `staticlib` is a system-dependant
library only intended for linking with non-Rust applications (C programs). Note
that `staticlib`s include all upstream dependencies (`core`, `std`, other user
dependencies, etc) which makes them significantly larger than `dylib`s:
prefer `staticlib` for linking with C programs. Learn more about different
`crate_type`s in [this section of the Reference](../reference/linkage.html).

This error can be fixed by:
 * Using [Cargo](../../cargo-doc/doc/index.html), the Rust package manager, automatically
   fixing this issue.
 * Recompiling the crate as a `rlib` or `dylib`; formats suitable for Rust
   linking.