Cross-compiler with ELF support is required for build of kvm-unit-tests on macOS.
$ brew install crosstool-ng
A case-sensitive APFS/HFS+ volume has to be created using Disk Utility as a build and installation directory for the cross-compiler. Please see Apple documentation for details.
Assuming the case-sensitive volume is named /Volumes/BuildTools, the cross-compiler can be built and installed there:
$ X_BUILD_DIR=/Volumes/BuildTools/ct-ng-build $ X_INSTALL_DIR=/Volumes/BuildTools/x-tools $ mkdir $X_BUILD_DIR $ ct-ng -C $X_BUILD_DIR x86_64-unknown-linux-gnu $ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
Once compiled, the cross-compiler can be used to build the tests:
$ ./configure --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu- $ make
x86_64-elf-gcc package in Homebrew provides pre-built cross-compiler but it fails to compile kvm-unit-tests.
GNU coreutils should be installed prior to running the tests:
$ brew install coreutils