I am preparing a package (which makes use of Rcpp and RcppArmadillo) for submission to CRAN. I am using Travis CI and I have included the following to test my package more thoroughly:
os:
- linux
- osx
compiler:
- clang
- gcc
This, however, yields the (familiar, it seems) error when using clang
on OS X
* installing *source* package ‘my_pkg’ ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Users/travis/R/Library/Rcpp/include" -I"/Users/travis/R/Library/RcppArmadillo/include" -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang: error: unsupported option '-fopenmp'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘pkg’
* removing ‘/Users/travis/build/my_user/pkg/pkg.Rcheck/pkg’
By appropriately adjusting my travis.yml
file to adhere to one of the workarounds suggested here, it seems like I can avoid the issue.
My question is: what should I do if I want to put this on CRAN? Jim's suggestions seems to me only local, do I have to do something in my package to automatically avoid the compile issue for the user in order to be accepted by CRAN?
Edit: To be a little bit more specific, could I just put CXX=g++
in Makevars
, or is that frowned upon (and would that be sufficient)?