# rust-lang/cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library

Repository: https://github.com/rust-lang/cc-rs
Canonical: https://ross.abutalabs.com/products/cc-rs
Homepage: https://docs.rs/cc
Language: Rust
License: Apache-2.0
License Family: permissive
Last push: 2026-08-25T02:53:14+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 86, longevity 100
- inputs: {"age_days": 4324, "days_push": 8, "days_rel": 12, "gap_med": 6.0, "n_releases_24m": 107}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2150, forks 609 (observed 2026-08-28T04:06:19.269685+00:00)

## What it is
cc-rs is a Rust library for Cargo build scripts that compiles C/C++/assembly/CUDA source files into a static archive to link into Rust crates. It invokes the platform's native compiler and automatically handles cross-compilation and environment variable configuration.

## Use cases
- compile C code from a Rust build script
- bundle C++ sources into a Rust crate
- link native C libraries into Rust projects
- handle cross-compilation of C dependencies in Cargo
- build CUDA or assembly files for a Rust crate

## When to choose
- your Rust crate needs to compile and statically link C/C++ code
- you want automatic compiler detection and cross-compilation support in build.rs
- you need a standard, widely-used solution for native code in Cargo packages

## When to avoid
- you only need to link pre-built libraries without compiling sources
- you want to invoke a non-default compiler with full manual control
- your project is not built with Cargo

## Facets
- artifact type: library
- maturity: stable
- function: build-tool, compiler, developer-tools
- domain: developer-tools, compilers, cross-platform
- platform: rust, cross-platform, windows
- tags: cargo, build-scripts, c-cpp, ffi, static-linking, cross-compilation, linux, macos

## Member repositories
- rust-lang/cc-rs (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:19.269685+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:50:58.289298+00:00, confidence not recorded.
  - readme: https://github.com/rust-lang/cc-rs (fetched 2026-08-28T04:06:19.269685+00:00, sha cc952a506dc7)
  - homepage: https://docs.rs/cc (fetched 2026-08-29T10:31:01.484707+00:00, sha 75dbaa1eace3)
  - site_page: https://docs.rs/ (fetched 2026-08-29T10:31:01.488130+00:00, sha d6ab278dde96)
  - site_page: https://docs.rs/crate/cc/latest (fetched 2026-08-29T10:31:01.490076+00:00, sha 34ba3ce8443d)
  - site_page: https://docs.rs/crate/cc/latest/features (fetched 2026-08-29T10:31:01.492208+00:00, sha f60757d1b81b)
  - site_page: https://docs.rs/about (fetched 2026-08-29T10:31:01.493966+00:00, sha 29ab7986fbf5)
  - site_page: https://docs.rs/about/badges (fetched 2026-08-29T10:31:01.495866+00:00, sha 6588cac258af)
  - site_page: https://docs.rs/about/builds (fetched 2026-08-29T10:31:01.497571+00:00, sha 811231ca4680)
  - site_page: https://docs.rs/about/metadata (fetched 2026-08-29T10:31:01.499345+00:00, sha 0dcdccb2b2b2)
  - site_page: https://docs.rs/about/redirections (fetched 2026-08-29T10:31:01.500936+00:00, sha 1b1efd93105f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
