我正在构建在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
实际上是一个文件。
答案 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安装的问题。解决这些问题:
cmake
(或任何位置适合您)将export RSTUDIO_WHICH_R=/opt/local/bin/R
指向R可执行文件的正确位置,如this RStudio Knowledge Base Article中所述。这解决了cmake
无法生成配置的问题。Rinternals.h
未找到的问题,请转到build/CMakeCache.txt
并更改LIBR_INCLUDE_DIRS
的路径,以反映Rinternals.h
的实际位置,在this RStudio Support Forum Question中描述。LIBR_EXECUTABLE
,LIBR_HOME
和LIBR_DOC_DIR
都指向正确的位置。如this webpage所述,您可以在R互动提示中执行R.home(component="home")
(或component="doc"
)来获取正确的位置。这将解决44%的构建错误,以及70-ish%时的额外错误。