Email me

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.

E0462Const, static and compile-time
Activein rustc 1.99.0
5related errors linked below

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 rlib or dylib; 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

All 518 Rust error codes · Rust crate data · Glossary

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?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ