Eberle, Anthony
2012-Sep-16 18:47 UTC
[R] Where is the R configuration file or how to override R compilers
I have a question about how one can modify or override the compilers that R uses for package installations? Or if perhaps this configuration is in some editable file somewhere. Initially I built the version of R 2.15.1 on Solaris SPARC (virtual T4), but found out the build was done as 32 bit. After some research, I found that the pre-compiled GCC version I had only allowed for 32 bit. I wanted 64 bit. Therefore I ended up download the SunStudio compilers (12.1 version) and was able to export the compiler commands (per the R manual) and get a 64 bit version running. The problem I have now is that I am trying to install the GBM package from CRAN (and from source as well.) What I find is that something keeps trying to run "c++" during compilation. Since I only have the SUN compiler the file is named "CC" not "c++". How do I override this? I've tried the following with no success: 1. EXPORT CXX to point to my CC compiler (eg export CXX='/opt/SUNWspro/bin/CC') 2. Create an alias to c++ (eg alias c++='/opt/SUNWspro/bin/CC') 3. I even tried to create a symlink for g++: ln -s /opt/SUNWspro/bin/CC c++ However none of these seem to work and I get the following error:># /usr/local/bin/R CMD INSTALL /export/home/downloads>* installing to library '/usr/local/lib/R/library' * installing *source* package 'gbm' ... ** package 'gbm' successfully unpacked and MD5 sums checked ** libs c++ -m64 -I/usr/local/lib/R/include -DNDEBUG -I/usr/local/include -KPIC -c adaboost.cpp -o adaboost.o bash: c++: command not found *** Error code 127 make: Fatal error: Command failed for target `adaboost.o' ERROR: compilation failed for package 'gbm' * removing '/usr/local/lib/R/library/gbm' Is there some environment variable or config file I can temporarily override this setting? My first thought was that I can try to build GCC from source, but I've spent two days trying to get that to work no success. In addition, trying to download the version from sun-freeware did not appear to work as well. Therefore that's why I am looking at this direction to see if there is a way I can get this package installed? I will note that if I manually compile the GBM source using "CC" it compiles fine. I just think something in R is overriding this. I tried installing from both the CRAN download as well as GBM source and get the same error. I don't see any configuration in the GBM tar ball so I assume that there is some standard packaging or configuration that R has when developing packages (have not fully read through those docs yet.) Any thoughts or pointers? Thanks in advance. Anthony [[alternative HTML version deleted]]
Berend Hasselman
2012-Sep-16 19:01 UTC
[R] Where is the R configuration file or how to override R compilers
On 16-09-2012, at 20:47, Eberle, Anthony wrote:> I have a question about how one can modify or override the compilers > that R uses for package installations? Or if perhaps this configuration > is in some editable file somewhere. > > Initially I built the version of R 2.15.1 on Solaris SPARC (virtual T4), > but found out the build was done as 32 bit. After some research, I > found that the pre-compiled GCC version I had only allowed for 32 bit. > I wanted 64 bit. Therefore I ended up download the SunStudio compilers > (12.1 version) and was able to export the compiler commands (per the R > manual) and get a 64 bit version running. The problem I have now is > that I am trying to install the GBM package from CRAN (and from source > as well.) What I find is that something keeps trying to run "c++" > during compilation. Since I only have the SUN compiler the file is > named "CC" not "c++". How do I override this? > > I've tried the following with no success: > 1. EXPORT CXX to point to my CC compiler (eg export > CXX='/opt/SUNWspro/bin/CC') > 2. Create an alias to c++ (eg alias c++='/opt/SUNWspro/bin/CC') > 3. I even tried to create a symlink for g++: ln -s /opt/SUNWspro/bin/CC > c++Assuming you mean the gbm package. I had a look in the src directory of that package. There are .cpp files, which are C++ source files so it's not surprising that a C++ compiler is required. That's why R wants to use c++. Berend
Dirk Eddelbuettel
2012-Sep-16 19:37 UTC
[R] Where is the R configuration file or how to override R compilers
On 16 September 2012 at 13:47, Eberle, Anthony wrote: | I have a question about how one can modify or override the compilers | that R uses for package installations? Or if perhaps this configuration | is in some editable file somewhere. You have several choices: a) system-wide: $R_HOME/etc/Makeconf (which we provide as a convenience link /etc/R/Makeconf on Debian/Ubuntu) b) per-user: ~/.R/Makevars (which is my preferred personal choice to set gcc option, select clang, ...) c) per-package src/Makevars I like b) a lot to add/remove language-options such as -std=c++0x or -pedantic, or to select clang / clang++ instead of gcc / g++, ... Greetings to Northbrook, Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com