• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Requirements
2
3This page lists the requirements for running `bindgen` and how to get them.
4
5## Clang
6
7`bindgen` leverages `libclang` to preprocess, parse, and type check C and C++
8header files.
9
10It is required to use Clang 5.0 or greater.
11
12### Installing Clang
13
14#### Windows
15
16If you use winget:
17```powershell
18winget install LLVM.LLVM
19```
20
21Alternatively, you can download and install the official pre-built binary from
22[LLVM download page](http://releases.llvm.org/download.html).
23
24You will also need to set `LIBCLANG_PATH` as an [environment
25variable](https://www.techjunkie.com/environment-variables-windows-10/) pointing
26to the `bin` directory of your LLVM install. For example, if you installed LLVM
27to `D:\programs\LLVM`, then you'd set the value to be `D:\programs\LLVM\bin`.
28
29Alternatively, for Mingw64, you can install clang via
30```bash
31pacman -S  mingw64/mingw-w64-x86_64-clang
32```
33
34#### macOS
35
36If you use Homebrew:
37
38```bash
39$ brew install llvm
40```
41
42If you use MacPorts:
43
44```bash
45$ port install clang
46```
47
48#### Debian-based Linuxes
49
50```bash
51# apt install llvm-dev libclang-dev clang
52```
53
54Ubuntu 18.04 provides the necessary packages directly.
55
56#### Arch
57
58```bash
59# pacman -S clang
60```
61
62#### Fedora
63
64```bash
65# dnf install clang-devel
66```
67
68#### OpenBSD
69
70```bash
71# pkg_add llvm
72```
73
74Add `export LIBCLANG_PATH=/usr/local/lib` to your profile.
75
76#### From source
77
78If your package manager doesn't yet offer Clang 5.0, you'll need to build from
79source. For that, follow the
80instructions [here](http://clang.llvm.org/get_started.html).
81
82Those instructions list optional steps. For `bindgen`:
83
84* Checkout and build clang
85* Checkout and build the extra-clang-tools
86* You do not need to checkout or build compiler-rt
87* You do not need to checkout or build libcxx
88