为CRAN做准备:'-fopenmp'clang错误? [英] Preparing for CRAN: '-fopenmp' clang error?

查看:103
本文介绍了为CRAN做准备:'-fopenmp'clang错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在准备一个程序包(利用Rcpp和RcppArmadillo)以提交给CRAN。我正在使用Travis CI,并且提供了以下内容来更彻底地测试我的软件包:

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

但是,在OS X上使用 clang 时,这会产生(熟悉的)错误

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’

通过适当地调整我的 travis.yml 文件以遵循建议的一种解决方法此处,看来我可以避免此问题。

By appropriately adjusting my travis.yml file to adhere to one of the workarounds suggested here, it seems like I can avoid the issue.

我的问题是:如果要将其放在CRAN上该怎么办? Jim的建议对我来说似乎仅是局部的,我是否必须在程序包中做一些事情以自动避免用户的编译问题,才能被CRAN接受?

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?

编辑:更具体一点,我可以将 CXX = g ++ 放入 Makevars 中,还是皱眉(这样就足够了吗?)?

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)?

推荐答案

所以……一次只需要一步。您要在这里使用哪个RcppArmadillo版本?您要使用哪个Clang版本?那个clang版本来自哪里?它具有OpenMP支持吗?

So ... one step at a time, please. Which RcppArmadillo version are you pulling in here? Which clang version are you pulling in? Where is that clang version from? Does it have OpenMP support?

从RcppArmadillo的上一个版本开始,我们确保只关闭OpenMP 在macOS上,因为构建支持太脆弱了,请参阅此GitHub上的PR 。因此,您可能必须删除文件中 -fopenmp 无条件使用,或者简单地不使用矩阵的那个单元格(即clang& ;& macOS)。

Starting with the previous release of RcppArmadillo, we ensured we simply turn OpenMP off on macOS as the build support is too fragile, see this PR on GitHub. So you may have to remove unconditional use of -fopenmp in your files, or simple not use that "cell" of your Matrix (ie clang && macOS).

否则,答案已经出现。在macOS上,事情变得更多了。

Otherwise, the answer by Jim Hester is spot-on. Things are just more work on macOS.

这篇关于为CRAN做准备:'-fopenmp'clang错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆