libc

Raw FFI bindings to platform system libraries for Rust

Library
Cargo
v1.0.0-alpha.4
2,612 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 96
Maintenance 96
Community 80
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 85
Code Quality 90
Innovation 70
Learning Curve 60

libc provides raw FFI (foreign function interface) bindings to the C system library on every platform Rust supports — type definitions like c_int, constants like EINVAL, and function declarations like malloc. It is one of the most-depended-upon crates in the Rust ecosystem, forming the low-level foundation that higher-level system-interaction crates build on.

All exported items match the exact types and values of the platform libc is compiled for, and everything is accessible directly under the crate root as libc::foo. It deliberately excludes Windows API bindings, which live in the separate windows-sys crate, keeping its scope tightly focused on C-compatible system interfaces across Unix-like systems, Windows’ C runtime, WASI, and embedded targets.

What You Get

  • Raw type definitions (c_int, c_char, etc.) matching each supported platform’s C ABI exactly
  • Constants for system-level values like errno codes (EINVAL), file flags, and signal numbers
  • Function declarations for core C library calls such as malloc, open, and pthread primitives
  • Platform-specific modules covering Unix variants, Windows’ C runtime, WASI, Fuchsia, and embedded/RTOS targets
  • A stable, near-universal dependency that higher-level crates (Tokio, nix, mio) build their safe abstractions on top of

Common Use Cases

  • Writing low-level system programming crates that need direct syscall or C library access
  • Building safe wrapper crates (like nix or mio) on top of libc’s raw bindings
  • Interfacing Rust code with existing C libraries that expect standard C types and constants
  • Implementing cross-platform low-level utilities that need to branch on platform-specific constants or types
  • Embedded or no-std development targeting RTOS platforms like Hermit, SGX, or VxWorks

Under The Hood

Architecture - The crate root (src/lib.rs) re-exports a large tree of platform-specific modules under src/unix/, src/windows/, src/wasi/, and further per-OS/per-arch subdirectories, each defining the exact struct layouts, constants, and extern "C" function signatures for that target. src/macros.rs and src/types.rs provide the code-generation macros used to keep thousands of near-identical platform declarations consistent, while build.rs handles target-specific compile-time configuration.

Tech Stack - Pure Rust with no_std support for embedded targets, dual-licensed MIT OR Apache-2.0, MSRV 1.65. The ci/verify-build.py script cross-compiles the crate against dozens of Tier 1/2/3 Rust targets (aarch64-apple-darwin, x86_64-pc-windows-msvc, wasm targets, RTOS targets, and more) to catch platform-specific breakage before release.

Code Quality - The libc-test/ctest subdirectories run a C-vs-Rust cross-validation suite that compiles small C programs against the actual system headers and compares struct layouts and constant values against what the crate declares — an unusually rigorous approach for an FFI-bindings crate, since a mismatched struct layout is undefined behavior rather than a compile error. The project is one of the most heavily reviewed crates in the Rust ecosystem given how many other crates transitively depend on it.

API Design - Because this is a raw FFI layer, the API is deliberately unsafe and matches C naming/signatures rather than idiomatic Rust conventions — callers are expected to wrap calls in safe abstractions themselves (which is exactly what crates like nix provide). There is effectively no onboarding curve for using individual bindings (libc::EINVAL, libc::malloc), but using them correctly requires C/systems-programming knowledge the crate does not abstract away.

Used by 24 apps in this directory

TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 5 days ago
Rust
54%
Other

Cap

Team Chat · Video Conferencing

22,884

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 54%
TypeScript 42%
Updated 5 days ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Rust
80%
MIT

fabro

Developer Tools · Devops

1,658

Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.

View details
82
Repo Health
83
Technical
67
Dependency
Built with
Rust 80%
TypeScript 15%
Updated 6 days ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 5 days ago
Rust
99%
Other

Fluree DB

Databases

469

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
87
Repo Health
74
Technical
65
Dependency
Built with
Rust 99%
Updated 6 days ago
Rust
88%
GPL 2.0

Fresh

Code Editors · Developer Tools

9,052

A zero-configuration terminal text editor with familiar keybindings, full mouse support, LSP-powered IDE features, and a built-in orchestrator for running multiple coding agents in parallel worktrees.

View details
86
Repo Health
88
Technical
71
Dependency
Built with
Rust 88%
Updated 6 days ago
Rust
94%
Apache 2.0

herdr

AI Agents · Developer Tools

41,057

A terminal-native agent multiplexer that runs Claude, Codex, Gemini, and other coding agents side by side in real, persistent panes you can detach from and reattach to from anywhere.

View details
84
Repo Health
84
Technical
72
Dependency
Built with
Rust 94%
Updated 6 days ago
Rust
73%
Other

iii

Developer Tools · Devops

18,814

Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 73%
TypeScript 16%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers