Crate gcc [] [src]

A library for build scripts to compile custom C code

This library is intended to be used as a build-dependencies entry in Cargo.toml:

gcc = "0.3"

The purpose of this crate is to provide the utility functions necessary to compile C code into a static archive which is then linked into a Rust crate. Configuration is available through the Build struct.

This crate will automatically detect situations such as cross compilation or other environment variables set by Cargo and will build code appropriately.

The crate is not limited to C code, it can accept any source code that can be passed to a C or C++ compiler. As such, assembly files with extensions .s (gcc/clang) and .asm (MSVC) can also be compiled.


Use the Build struct to compile src/foo.c:

extern crate gcc;

fn main() {
               .define("FOO", Some("bar"))



A helper module to probe the Windows Registry when looking for windows-specific tools.



Extra configuration to pass to gcc.


Represents an internal error that occurred, with an explaination.


Configuration used to represent an invocation of a C compiler.