How to compile R/igraph from source, with all features enabled?

macOS

Choose a section depending on whether you want to use developer tools from the official RTools, MacPorts, or Homebrew.

RTools

TODO

Get the developer tools from:

Download the dependencies (GLPK and libxml2 libraries) from:

MacPorts

Warning: If you are using the official R distribution, using other compilers than what come with RTools is not officially supported by the R maintainers.

Install compilers and libraries:

sudo port install clang-14 gcc11 libxml2 glpk

We need to ensure that R will use the compilers and libraries from MacPorts. Place the following in ~/.R/Makevars:

CC = /opt/local/bin/clang-mp-14
CXX = /opt/local/bin/clang++-mp-14
FC = /opt/local/bin/gfortran-mp-11
F77 = /opt/local/bin/gfortran-mp-11
FLIBS = -L/opt/local/lib/gcc11 -lgfortran -lquadmath -lm
CPPFLAGS=-I/opt/local/include
LDFLAGS=-L/opt/local/lib

If you install different versions of compilers than what is shown above, the contents of Makevars will need to be updated accordingly.

Homebrew

Warning: If you are using the official R distribution, using other compilers than what come with RTools is not officially supported by the R maintainers.

TODO