Requirements
This page lists the requirements for runningbindgen
and how to get them.
Clang
bindgen
leverageslibclang
to preprocess, parse, and type check C and C++header files.
It is required to use Clang 9.0 or greater.
Installing Clang
Windows
If you use winget:
winget install LLVM.LLVM
Alternatively, you can download and install the official pre-built binary fromLLVM download page.
You will also need to setLIBCLANG_PATH
as anenvironmentvariable pointingto thebin
directory of your LLVM install. For example, if you installed LLVMtoD:\programs\LLVM
, then you'd set the value to beD:\programs\LLVM\bin
.
Alternatively, for Mingw64, you can install clang via
pacman -S mingw64/mingw-w64-x86_64-clang
macOS
If you use Homebrew:
$ brew install llvm
If you use MacPorts:
$ port install clang
Debian-based Linuxes
# apt install libclang-dev
If you want to use the functionbindgen::Builder::dump_preprocessed_input
, then you also need the packageclang
.
Arch
# pacman -S clang
Fedora
# dnf install clang-devel
OpenBSD
# pkg_add llvm
Addexport LIBCLANG_PATH=/usr/local/lib
to your profile.
From source
If your package manager doesn't yet offer Clang 9.0, you'll need to build fromsource. For that, follow theinstructionshere.
Those instructions list optional steps. Forbindgen
:
- Checkout and build clang
- Checkout and build
clang-tools-extra
- You do not need to checkout or build compiler-rt
- You do not need to checkout or build libcxx