This web site is not a blog, even though it's a collection of random pieces of text on different subjects. However, I prefer more structure to the pages than the continuous flow common to the blog.

While writing this, I am working on a project involving inference of pedigrees from a moderate set of pine samples genotyped with the PiSy50k SNP Chip by Kastally et al (2021). I wanted to try the original KING software for this purpose, as I had used the similar approaches with the SNPRelate package in R. However, the King authors have only published Linux/amd64 and windows binaries, while I would like to run the analysis on my MacBook. Luckily, the source code is also available.

Compiling the OpenMP parallelised code on the Mac with Xcode proved not to work out of the box, as LLVM, as shipped in Xcode, is lacking the necessary libraries. Compiling as per the original instructions yields:

$ c++ -fopenmp -lm -lz -O2 *.cpp       
clang++: error: unsupported option '-fopenmp'
clang++: error: unsupported option '-fopenmp'
clang++: error: unsupported option '-fopenmp'

Some googling revealed that either one could install gcc with homebrew to get openmp, then the line above would work. However, I also noted on this page of the R for MacOS project that there is actually openmp support in LLVM, if only the libraries/runtime are installed. Following their instructions, compiling KING on MacOS actually works fine (albeit with some complaints about the use of sprintf).

Based on the sources above, the commands used to compile KING on MacOS (Sequoia) were:

$ wget https://www.kingrelatedness.com/KINGcode.tar.gz
$ tar xzf KINGcode.tar.gz
$ wget https://mac.r-project.org/openmp/openmp-19.1.0-darwin20-Release.tar.gz
$ sudo tar fvxz openmp-19.1.0-darwin20-Release.tar.gz -C / # Installs in /usr/local
$ c++ -Xclang -fopenmp -lm -lz -lomp -O2 -o king *.cpp

Of course, this has to be updated when new versions are released.


Copyright © 2025 Mikael Durling. Published May 21, 2025, updated June 4, 2025.