explaingit

fractalfir/crustc

Analysis updated 2026-05-18

331CAudience · developerComplexity · 5/5Setup · hard

TLDR

crustc is the entire Rust compiler translated into 46 million lines of C, letting you build a working Rust compiler with only GCC and make to support platforms that have no native Rust toolchain.

Mindmap

mindmap
  root((crustc))
    What it is
      Rust compiler in C
      46 million lines
      Demo for cilly
    How it works
      GCC builds it
      LLVM for codegen
      GNU make
    cilly toolchain
      Rust to C compiler
      Probes target compiler
      Network transparent
    Use cases
      Old hardware support
      Cross compile Rust
      Obscure OS targets
    Setup
      GCC and make
      LLVM version match
      ARM64 Linux tested
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a working Rust compiler on hardware that only has a C compiler, enabling Rust where no official toolchain exists.

USE CASE 2

Cross-compile Rust programs for obscure or legacy targets using the cilly Rust-to-C backend.

USE CASE 3

Run the Rust compiler on a Linux host and compile for a remote non-standard OS target over a TCP connection.

USE CASE 4

Study how a Rust-to-C compiler backend probes and adapts to different C compiler capabilities.

What is it built with?

CRustGCCLLVMmake

How does it compare?

fractalfir/crustcfacex-engine/facexammarkov/sam3dbody-cpp
Stars331189563
LanguageCCC
Setup difficultyhardmoderatehard
Complexity5/54/55/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires GCC, GNU make, and a specific LLVM version matching the nightly Rust toolchain, building with optimizations may stall on large generated files.

In plain English

Rust is a programming language. A compiler is the tool that translates code written by humans into instructions a computer can actually run. This repo contains the entire Rust compiler, converted into the C programming language, resulting in 46 million lines of C code. The practical result is that you can now build the Rust compiler itself using GCC, which is one of the oldest and most widely available C compilers in existence. GCC can run on old and obscure hardware that never received official Rust support. This means you can write programs in Rust and still target hardware that would otherwise be incompatible. This is a demo for a larger project called cilly. The cilly toolchain is a Rust-to-C compiler that can translate any Rust code into C, not just the Rust compiler itself. The clever part is that cilly probes the C compiler on your target platform first, checking what features it actually supports, then generates output tailored to that specific compiler and hardware combination. This makes it compatible with obscure or old C compilers that would choke on standard assumptions. A standout feature is network transparency. You can run the Rust compiler on a normal Linux machine while sending the C compilation work over a network connection to another computer running a completely different operating system or processor architecture. The author demonstrated this by compiling Rust programs for an x86 Plan 9 operating system from an ARM64 Linux machine. To build this demo yourself you need GCC, GNU make, and a specific version of LLVM, the code generation library that Rust normally uses internally. Building without optimizations takes about 78 seconds on the author's machine. The cilly toolchain itself is not yet publicly released, this repo is a teaser showing what it can do.

Copy-paste prompts

Prompt 1
Walk me through building crustc on an ARM64 Linux machine with GCC 13, including providing the correct LLVM library path.
Prompt 2
How does the cilly toolchain generate C code compatible with different C compilers using witness programs?
Prompt 3
What is the network transparency feature of cilly and how do I set it up to compile Rust for a remote target over TCP?
Prompt 4
How do I build the Rust standard library (std) after successfully compiling crustc from source?
Prompt 5
Show me a cilly config snippet for targeting an SDCC Z180 embedded compiler.

Frequently asked questions

What is crustc?

crustc is the entire Rust compiler translated into 46 million lines of C, letting you build a working Rust compiler with only GCC and make to support platforms that have no native Rust toolchain.

What language is crustc written in?

Mainly C. The stack also includes C, Rust, GCC.

How hard is crustc to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is crustc for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub fractalfir on gitmyhub

Verify against the repo before relying on details.