【问题标题】:Installing package on R, need C++11 support for OSX在 R 上安装包,需要对 OSX 的 C++11 支持
【发布时间】:2016-02-24 19:47:27
【问题描述】:

我正在尝试为贝叶斯面向对象建模及其依赖项 BoomSpikeSlab, bsts 安装 library(Boom)。但是,我总是得到来自R 的相同回复:

In file included from Models/Glm/MultinomialLogitModel.cpp:31:
In file included from     ../inst/include/Models/Glm/PosteriorSamplers/MLVS.hpp:25:
In file included from     ../inst/include/Models/Glm/PosteriorSamplers/MLVS_data_imputer.hpp:25:
../inst/include/Models/PosteriorSamplers/Imputer.hpp:30:10: fatal     error: 'future' file not found
#include <future>
     ^
 1 error generated.
 make: *** [Models/Glm/MultinomialLogitModel.o] Error 1
ERROR: compilation failed for package ‘Boom’
* removing ‘/usr/local/lib/R/3.2/site-library/Boom’
Warning in install.packages :
installation of package ‘Boom’ had non-zero exit status
 ERROR: dependency ‘Boom’ is not available for package ‘BoomSpikeSlab’
 * removing ‘/usr/local/lib/R/3.2/site-library/BoomSpikeSlab’
Warning in install.packages :
 installation of package ‘BoomSpikeSlab’ had non-zero exit status
 ERROR: dependencies ‘BoomSpikeSlab’, ‘Boom’ are not available for     package ‘bsts’
* removing ‘/usr/local/lib/R/3.2/site-library/bsts’
  Warning in install.packages :
installation of package ‘bsts’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/s2/9wz53mrj0vqcpj9v3zjwx6q80000gn/T/RtmpvMmIug/downloaded_packages’

我认为这可能与我的问题有关 pip cffi package installation failed on osx

所以我尝试了:

xcode-select --install

导致:

xcode-select: Error: unknown command option '--install'.

xcode-select: Report or change the path to the active
          Xcode installation for this machine.

Usage: xcode-select --print-path
       Prints the path of the active Xcode folder
  or: xcode-select --switch <xcode_path>
       Sets the path for the active Xcode folder
  or: xcode-select --version
       Prints the version of xcode-select

如何安装Boompackage?

我正在使用 Mac OSX 10.8.5Xcode version: 5.1.0 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin12.6.0

【问题讨论】:

  • 我刚安装没问题。 install 是否记录为 man xcode-select 中的允许开关?
  • 嗨,不,不是。可能是因为Xcode 5.1.0
  • 您是否安装了 C++11 编译器? std::future 是新的。
  • 我在尝试安装 imager 包时也遇到了类似的缺少库问题。我安装了cimg-dev,它成功了。 std::future 库是在 C++11 中添加的,结果 Boom 包需要 C++ 11。所以这肯定是缺少库的问题。
  • 我认为不是库问题,而是语言版本问题。我不熟悉 OSX,所以我不知道在 R 构建包时如何选择 C++11 语言版本。见这里:stackoverflow.com/questions/19089293/…

标签: r macos c++11


【解决方案1】:

好吧,Boom 在 CRAN 上,所以它的构造必须使用默认工具链

您是否安装了BH?至少早在 2013 年 3 月(当时我们添加了对 Rcpp::plugin(cpp11) 的支持时,我们在Rcpp 中添加了可选 C++11 支持,因此相应的 clang 版本运行了多年。

【讨论】:

  • 嗨,Dirk,谢谢你的建议。我已经安装了BH。但是,install.packages("Boom")results 的输出与上述相同
  • 是的,dplyr我可以安装。使用clang++Boom 使用 clang++ -std=c++11
  • 这就是我之前告诉你的:它在 CRAN 上,所以它通过了非常严格的可构建性测试。如果它最终失败,我会首先查看您的设置
  • 直到今天我还以为我有一个相当标准的设置,但是“Boom”无法编译...任何想法/建议可以查看我的明显非标准设置与标准有何不同,以便“Boom”不编译? ;) 我环顾四周 SO 和 www 一般没有成功。
  • 我问了一个单独的问题stackoverflow.com/questions/36034316/…
猜你喜欢
  • 2017-01-13
  • 2023-02-07
  • 2022-11-04
  • 2016-10-20
  • 1970-01-01
  • 2013-01-03
  • 2017-01-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多