Expand description
cargo-libc: build Rust programs for an older glibc.
cargo-libc is a Cargo subcommand, cargo libc. It builds x86_64 Linux programs on
a current machine for a glibc release you choose, 2.17 through 2.44. It links
against exactly what that release defines, checks the executables’ requirements,
and runs tests under a simulation of the target’s kernel.
cargo libc build --target x86_64-unknown-linux-gnu.2.17 \
--artifact target/x86_64-unknown-linux-gnu/release/myapp -- --releaseInstall it with cargo install cargo-libc --locked, and read how to use it in the
user guide
and the README.
§The library
This library is the implementation of cargo-libc’s five executables, and is not meant to be used directly. Its public items are their entry points:
| Executable | Entry point | Role |
|---|---|---|
cargo-libc | cli::run | The cargo libc command |
libc-linker | toolchain::run_linker | The linker Cargo calls for target units |
libc-runner | simulate::run_program | Cargo’s target runner for test and run |
libc-cc | cc::run with cc::Language::C | The C compiler for the cc crate and CMake |
libc-cxx | cc::run with cc::Language::Cxx | The C++ compiler: host units only |
To use provider preparation or ELF scanning from your own code, depend on
libc-abi-tools and
linux-abi-scan.
Modules§
- cc
- Compiler wrappers for C dependencies (
libc-cc, andlibc-cxxto refuse C++). - cli
- The
cargo-libccommand line:cargo libc <command>, parsed and run. - simulate
- Tier 2:
cargo libc testandcargo libc runexecute each target binary through thelibc-runnerhelper, which Cargo calls as its target runner. - toolchain
- Toolchain selection and the Cargo commands that use it, and
libc-linker, the linker Cargo calls for target units.