Cargo

4 Posts

Publishing CLI tools, crates, and versions

6 minute

When a C project is shipped to other people, the hard part is often not whether the source builds. The hard part is the contract around it:

How is the tool installed into PATH?
Where do the headers and libraries go?
Which version should users link against?
Will an upgrade break existing code?
Does a public API change count as compatible?
Can the binary ABI remain stable over time?

Rust has the same questions, but the shipped object usually falls into one of three groups:

Read More

release, cross compilation, and binary size

6 minute

Before delivering a C project, “it compiles” is not enough.

You still check:

whether release optimization is enabled
whether architecture and ABI match the target
whether linked libraries are target libraries or host libraries
whether the binary carries unnecessary symbols
whether runtime dynamic dependencies exist on the target
whether size fits device limits
whether crashes can still be symbolized

Rust delivery for CLI tools, system libraries, or C/Rust boundary artifacts has the same concerns. Cargo simplifies the build command, but it does not remove release checks.

Read More

workspace, features, and build configuration

6 minute

As C projects grow, they often accumulate:

several static libraries and command-line tools
public and internal headers
Makefile subdirectories
CONFIG_XXX / #ifdef switches
Debug/Release compiler flags
target platform differences

Rust projects face the same issues with different tools:

workspace -> manages several crates
crate     -> boundary for a library or executable target
feature   -> optional capabilities and optional dependencies
profile   -> debug/release build parameters
cfg       -> platform and conditional compilation

This article does not cover every Cargo feature. It focuses on the organization needed for libraries, CLI tools, and C/Rust boundaries.

Read More

Start with main and Cargo

6 minute

For a C developer writing Rust for the first time, the unfamiliar part is often not if, for, or function calls. The first real difference is the engineering entry point: C programs often begin with main.c, gcc, Makefiles, and argc/argv; Rust programs usually begin inside a Cargo project.

That is not just a tooling difference. Cargo manages source layout, dependencies, builds, tests, and package metadata. main also becomes more than a function returning an integer: error handling, standard output, standard error, and exit status enter the program structure early.

Read More