0

I'm building the latest github version of rstudio-server to run on OSX Yosemite, but can't get it to find the macports R libraries when installing.

I run into a "Minimum R version (2.11.1) not found." error when I run
cmake -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release ..
but when I pass -DRSTUDIOVERIFYR_VERSION=0 as well, I configure successfully and make it to about 44% before the build fails:

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.

I was able to find Rinternals.h in /opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders/Rinternals.h (EDIT: also in /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/include/Rinternals.h), but how do I point the build configuration to this location?

EDIT: Additionally, I experienced another problem where the build failed at about 70% with the error
/opt/local/lib/libR.dylib/Resources/R: not a directory
make[2]: *** [src/cpp/r/R/packages/library/manipulate/DESCRIPTION] Error 126 Upon further investigation, /opt/local/lib/libR.dylib/Resources/R does not exist, because /opt/local/lib/libR.dylib is actually a file.

Roger Filmyer
  • 676
  • 1
  • 8
  • 24

3 Answers3

0

Not sure about the specifics of cmake but you can try

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

to tell the compiler to look for header files in the location where you found them.

damienfrancois
  • 52,978
  • 9
  • 96
  • 110
  • I reconfigured, and this time I had no problems with using cmake. When building, the error persists. – Roger Filmyer Nov 06 '14 at 19:00
  • This should work, but some older versions of clang don't support CPATH (see http://llvm.org/bugs/show_bug.cgi?id=8971), so try working around that (see my answer). – Jeremy Huddleston Sequoia Nov 07 '14 at 03:15
  • Hmm... actually it looks like I didn't actually solve the problem; when I wiped out my build folder of the install and started fresh, it came back with the error – Roger Filmyer Nov 07 '14 at 17:04
0

Add -I /opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders/ to the compiler's command line.

Alternatively, you can set CPLUS_INCLUDE_PATH in the environment to tell the compiler where to search for additional headers when compiling C++ code. You may also want to set C_INCLUDE_PATH for C if needed.

$ export CPLUS_INCLUDE_PATH=/opt/local/Library/Frameworks/R.framework/Versions/3.1/PrivateHeaders
$ make
Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • So turns out I can't even get it to configure with cmake properly; I was just using the `-DRSTUDIOVERIFYR_VERSION=0` configuration. On a clean `cmake` I'm back to square one. – Roger Filmyer Nov 09 '14 at 02:00
  • I found the solution, which was in a poorly documented environment variable called `RSTUDIO_WHICH_R`. Your answer pointed me in the right direction, though, so thank you very much. – Roger Filmyer Nov 09 '14 at 06:29
0

This appears to be a problem with the RStudio cmake script not properly detecting a MacPorts R installation. To fix these problems:

  1. Point cmake to the correct location of your R executable using export RSTUDIO_WHICH_R=/opt/local/bin/R (or whatever the location is for you), as described in this RStudio Knowledge Base Article. This solves the problem with cmake failing to generate a configuration.
  2. To solve the problems with Rinternals.h not being found, go into build/CMakeCache.txt and change the path of LIBR_INCLUDE_DIRS to reflect Rinternals.h's actual location, as described in this RStudio Support Forum Question.
  3. Ensure that LIBR_EXECUTABLE, LIBR_HOME, and LIBR_DOC_DIR all point to the correct location. You can get the correct locations by doing R.home(component="home") (or component="doc") in an R interactive prompt, as described on this webpage. This will solve the build error at 44%, and the additional error I had at 70-ish%.
Roger Filmyer
  • 676
  • 1
  • 8
  • 24