Cross compilation on MacOS

This is a first attempt to support Cross compilation of VPP on MacOS for development (linting, completion, compile_commands.json)


  • You'll need to install the following packages

$ pip3 install ply pyyaml jsonschema
$ brew install gnu-sed pkg-config ninja crosstool-ng
  • You'll also need to install clang-format 11.0.0 to be able to make checkstyle. This can be done with this doc

  • You should link the binaries to make them available in your path with their original names e.g. :

$ ln -s $(which gsed) /usr/local/bin/sed


  • Create a cross compile toolchain

  • Create a case sensitive volume and mount the toolchain in it e.g. in /Volumes/xchain

  • Create a xchain.toolchain file with $VPP_DIR/extras/scripts/ conf /Volumes/xchan

For now we don't support e-build so dpdk, rdma, quicly won't be compiled as part of make build

To build with the toolchain do:

$ $VPP_DIR/extras/scripts/ build

To get the compile_commands.json do

$ $VPP_DIR/extras/scripts/ cc
$ >> ./build-root/build-vpp[_debug]-native/vpp/compile_commands.json

This should build vpp on MacOS

Good luck :)

Installing clang-format 11.0.0

In order to install clang-format on macos :

brew install clang-format@11
wget \
    -O /usr/local/Cellar/clang-format@11/11.1.0/bin/
chmod +x /usr/local/Cellar/clang-format@11/11.1.0/bin/
ln -s /usr/local/Cellar/clang-format@11/11.1.0/bin/ /usr/local/bin/clang-format-diff-11
ln -s /usr/local/Cellar/clang-format@11/11.1.0/bin/clang-format-11 /usr/local/bin/clang-format

Source Clang website