How to create an Opam switch with a custom C compiler You can use Dune to compile the C++ code. Here's how you can create a custom Opam switch that uses Clang rather than GCC. Install dependencies Make sure you have the following packages on your system: libcxx-devel libcxxabi-devel