Rust errors / Const, static and compile-time
Rust compiler error · checked with rustc 1.99.0
Rust error E0462: found `staticlib` `..` instead of `rlib` or `dylib`
What it meansFound staticlib .. instead of rlib or dylib.
The compiler team's explanation
Found staticlib .. instead of rlib or dylib.
Consider the following two files:
a.rs
#![crate_type = "staticlib"]
fn foo() {}
main.rs
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 staticlibs include all upstream dependencies (core, std, other user dependencies, etc) which makes them significantly larger than dylibs: prefer staticlib for linking with C programs. Learn more about different crate_types in this section of the Reference.
This error can be fixed by:
- Using Cargo, the Rust package manager, automatically fixing this issue.
- Recompiling the crate as a
rlibordylib; formats suitable for Rust linking.
From rustc --explain E0462 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
Up next
Often hit nextE0015: cannot call non-const fn in constantsA related error from the same family.Read it next →Did this answer your question?