mrc-ide / odin.dust

Compile odin to dust
https://mrc-ide.github.io/odin.dust
Other
3 stars 1 forks source link

Compilation error with clang and openmp #99

Open tcortier opened 2 years ago

tcortier commented 2 years ago

Hi,

I try to use the odin_dust function to compile a model and I have the following compile error:

clang: error: unsupported option '-fopenmp'

Apparently this is not easy to fix on macs and I was wondering if we could change the compiler options or the compiler to work around this problem?

Best regards,

Thomas

richfitz commented 2 years ago

OMP support is do-able on macs, but you need to install all sorts of things manually - see the R docs. I believe it can also be set up with brew (e.g. this old post, which may or may not still be correct).

On the Mac that I have access to, which does not have OMP support installed, I have

SHLIB_OPENMP_CFLAGS=
SHLIB_OPENMP_CXXFLAGS=

in my ~/.R/Makevars which prevents use if -fopenmp and allows compilation in serial mode. You can use usethis::edit_r_makevars to set that up

Note that R on recent Macs is also a bit annoying as you can't run it under a debugger without installing a non-notarised version of R