fs
fs copied to clipboard
OpenMP: unsupported option -fopenmp
On recent versions of macOS, you enable OpenMP support by appending -Xclang -fopenmp to PKG_CPPFLAGS and -lomp to PKG_LIBS. It works nicely then when you install packages such as RcppArmadillo. I am only having trouble with fs, which fails to compile libuv with OpenMP flags on. It works well if I remove them.
I will consider a PR for this if you want to submit one.
It seems main builds successfully with
PKG_CPPFLAGS += -I/opt/homebrew/opt/libomp/include -Xclang -fopenmp
PKG_LIBS += -L/opt/homebrew/opt/libomp/lib -lomp
but fails with
CPPFLAGS += -I/opt/homebrew/opt/libomp/include -Xclang -fopenmp
LDFLAGS += -L/opt/homebrew/opt/libomp/lib -lomp
(which uses recommended flags by https://mac.r-project.org/openmp).
#417 is a simple fix for the latter.