Installation

Prerequisites

C2Rust requires LLVM 6 or 7 and its corresponding libraries and clang compiler. Python 3.4 or later, CMake 3.4.3 or later, and openssl (1.0) are also required. These prerequisites may be installed with the following commands, depending on your platform:

  • Ubuntu 16.04, 18.04 & 18.10:
  1. apt install build-essential llvm-6.0 clang-6.0 libclang-6.0-dev cmake libssl-dev pkg-config
  • Arch Linux:
  1. pacman -S base-devel llvm clang cmake openssl
  • OS X: XCode command-line tools and recent LLVM (we recommend the Homebrew version) are required.
  1. xcode-select --install
  2. brew install llvm python3 cmake openssl

Finally, a rust installation with Rustup is required on all platforms. You will also need to install rustfmt:

  1. rustup component add rustfmt-preview

Building C2Rust

  1. cargo build --release

This builds the c2rust tool in the target/release/ directory.

On OS X with Homebrew LLVM, you need to point the build system at the LLVM installation as follows:

  1. LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo build

If you have trouble with cargo build, the developer docs provide more details on the build system.