• 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
16Download and install the official pre-built binary from
17[LLVM download page](http://releases.llvm.org/download.html).
18
19You will also need to set `LIBCLANG_PATH` as an [environment
20variable](https://www.techjunkie.com/environment-variables-windows-10/) pointing
21to the `bin` directory of your LLVM install. For example, if you installed LLVM
22to `D:\programs\LLVM`, then you'd set the value to be `D:\programs\LLVM\bin`.
23
24Alternatively, for Mingw64, you can install clang via
25```bash
26pacman -S  mingw64/mingw-w64-x86_64-clang
27```
28
29#### macOS
30
31If you use Homebrew:
32
33```bash
34$ brew install llvm
35```
36
37If you use MacPorts:
38
39```bash
40$ port install clang
41```
42
43#### Debian-based Linuxes
44
45```bash
46# apt install llvm-dev libclang-dev clang
47```
48
49Ubuntu 18.04 provides the necessary packages directly.
50
51#### Arch
52
53```bash
54# pacman -S clang
55```
56
57#### Fedora
58
59```bash
60# dnf install clang-devel
61```
62
63#### OpenBSD
64
65```bash
66# pkg_add llvm
67```
68
69Add `export LIBCLANG_PATH=/usr/local/lib` to your profile.
70
71#### From source
72
73If your package manager doesn't yet offer Clang 5.0, you'll need to build from
74source. For that, follow the
75instructions [here](http://clang.llvm.org/get_started.html).
76
77Those instructions list optional steps. For `bindgen`:
78
79* Checkout and build clang
80* Checkout and build the extra-clang-tools
81* You do not need to checkout or build compiler-rt
82* You do not need to checkout or build libcxx
83