1

I've just updated R from 3.3.1 to 3.4.1. Now I can't use the plugin sourceCpp() to source C++-code. When trying to source the function rcppfunc I get the error:

clang: error: unsupported option '-fopenmp' make: *** [rcppfunc.o] Error 1

Before updating everything worked as it should.

Has anyone else had similar C++-compiler issues with 3.4.1?

xaxxon
  • 19,189
  • 5
  • 50
  • 80
Adam
  • 87
  • 5
  • 1
    That is a macOS specific issue; I would try to seek help on the respective mailing list. In short. the change is in how R calls `R CMD ...` and not in Rcpp. – Dirk Eddelbuettel Jul 25 '17 at 11:19

1 Answers1

2

See the following post explaining how to resolve the -fomp error by enabling OpenMP compilations:

http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/

In particular, you can obtain the binary installer I made here:

https://uofi.box.com/v/r-macos-clang-pkg

This is based off of the pre-compiled clang4 binary available here:

http://r.research.att.com/libs/

coatless
  • 20,011
  • 13
  • 69
  • 84
  • Yes I did look at your blog post there before asking the questions but thought it looked like a great ordeal to go through. I should have the right compilers etc (or at least used to) and don't understand what it is that's different from 3.3.1 to 3.4.1. I've downloaded your clang4-r.pkg. If I install this then what happens? Thanks Adam! – Adam Jul 25 '17 at 19:26
  • Read >= R 3.4.0 section of post. It explains these changes. http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/#after-3-4-0 I'll improve the tl;dr read of it later this weekend. – coatless Jul 25 '17 at 19:31
  • Ok thanks, haven't installed anything yet. Btw do you know how come I can still use Rcpp when building R packages? Right now as a fallback, instead of directly sourcing C++ code inline, I include it as an R-package. – Adam Jul 28 '17 at 07:46
  • Certain packages (e.g. RcppArmadillo) now have OpenMP flags enabled by default. Unless you disable the flag in Makevars you _will_ get an OpenMP compilation attempt. – coatless Jul 28 '17 at 16:24