RStudio Server在构建时没有为Macports R找到库

时间:2014-11-06 16:00:08

标签: macos rstudio macports rstudio-server

我正在构建在OSX Yosemite上运行的最新github版本的rstudio-server,但在安装时无法找到macports R库。

我遇到了“未找到最小R版本(2.11.1)”。我跑的时候出错了 cmake -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release ..
但是当我通过-DRSTUDIOVERIFYR_VERSION=0时,我成功配置并在构建失败之前将其调整到大约44%:

Rogers-iMac:build roger$ sudo make install
Password:
Scanning dependencies of target gwt_build
Buildfile: /Users/roger/projects/rstudio/src/gwt/build.xml
[...]
Scanning dependencies of target rstudio-r
[ 44%] Building CXX object src/cpp/r/CMakeFiles/rstudio-r.dir/RErrorCategory.cpp.o
[ 44%] Building CXX object src/cpp/r/CMakeFiles/rstudio-r.dir/RExec.cpp.o
In file included from /Users/roger/projects/rstudio/src/cpp/r/RExec.cpp:17:
In file included from /Users/roger/projects/rstudio/src/cpp/r/include/r/RExec.hpp:30:
In file included from /Users/roger/projects/rstudio/src/cpp/r/include/r/RSexp.hpp:33:
/Users/roger/projects/rstudio/src/cpp/r/include/r/RInternal.hpp:43:10: fatal error: 'Rinternals.h' file not found
#include <Rinternals.h>
         ^
1 error generated.

我能够在Rinternals.h中找到/opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders/Rinternals.h编辑:也在 /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/include/Rinternals.h中),但如何将构建配置指向此位置?

编辑:此外,我遇到了另一个问题,即构建失败率约为70%且出现错误
/opt/local/lib/libR.dylib/Resources/R: not a directory
make[2]: *** [src/cpp/r/R/packages/library/manipulate/DESCRIPTION] Error 126 经过进一步调查,/opt/local/lib/libR.dylib/Resources/R不存在,因为/opt/local/lib/libR.dylib实际上是一个文件。

3 个答案:

答案 0 :(得分:0)

不确定cmake的细节,但您可以尝试

$ export CPATH=$CPATH:/opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders/
$ sudo make install

告诉编译器在找到它们的位置查找头文件。

答案 1 :(得分:0)

-I /opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders/添加到编译器的命令行。

或者,您可以在环境中设置CPLUS_INCLUDE_PATH,以告诉编译器在编译C ++代码时在哪里搜索其他标头。如果需要,您可能还想为{C}设置C_INCLUDE_PATH

$ export CPLUS_INCLUDE_PATH=/opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders
$ make

答案 2 :(得分:0)

这似乎是RStudio cmake脚本无法正确检测MacPorts R安装的问题。解决这些问题:

  1. 使用cmake(或任何位置适合您)将export RSTUDIO_WHICH_R=/opt/local/bin/R指向R可执行文件的正确位置,如this RStudio Knowledge Base Article中所述。这解决了cmake无法生成配置的问题。
  2. 要解决Rinternals.h未找到的问题,请转到build/CMakeCache.txt并更改LIBR_INCLUDE_DIRS的路径,以反映Rinternals.h的实际位置,在this RStudio Support Forum Question中描述。
  3. 确保LIBR_EXECUTABLELIBR_HOMELIBR_DOC_DIR都指向正确的位置。如this webpage所述,您可以在R互动提示中执行R.home(component="home")(或component="doc")来获取正确的位置。这将解决44%的构建错误,以及70-ish%时的额外错误。