问题
I've downloaded Rcpp from CRAN and unzipeed it and attempted to build it. When I try to use R CMD INSTALL . in the directory I get:
cp: unknown option -- )
If I try to open up a session and use install.packages("Rcpp", type = "source"), I get the following error from g++
:
*** arch - x64
g++ -m64 -I"C:/R/R-30~1.1/include" -DNDEBUG -I../inst/include/ -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c Date.cpp -o Date.o
Date.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
make: *** [Date.o] Error 1
I have Rtools installed, and its directories are in the front of my path. I am on 64-bit Windows 7. Are there install options that I am missing? I have been reading appendix D of R's Installation and Administration manual and can't find anything I might have violated, everything was installed through Rtools. I feel like there is a flag that I am not including but I can't figure out what.
回答1:
This problem started working once I did the following (I'm not sure which one fixed it) listed in consecutive order:
-threw my coffee cup against the wall, cursing Dirk Eddelbuettel
-changed the R path variable from C:R\R-3.0.1\bin to C:\R\R-3.0.1\bin\x64\
-reinstalled Rtools, this time checking the box allowing it to change the system path, I had been changing my user path before
-asked the spirit of Dirk Eddelbuettel for forgiveness
-restarted Rstudio
It worked. I think it was because I was not considering the system path, which is read first in windows, and so it was running into a Haskell g++ compiler, which was in front of everything, and only 32 bit.
回答2:
Platform: Windows 7 64 bit
R version: 3.1.2
Rtools: Rtools32 windows binary
At least on my windows box, installing Rtools does not add the relevant values to the PATH Environment variable. To manually set the relevant values of your PATH environment variable, do the following:
(Click "Windows Icon --> right click "Computer" --> choose "Properties" --> Click "Advanced System Settings" --> click "Environment Variables" --> choose "PATH" and click "Edit" --> add the following to the PATH variable)
C:\Program Files\R\R-3.1.2\bin\x64;C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;
- Make sure no spaces in between path values
- Failing to specify gcc directory (as in C:\Rtools\gcc-4.6.3\bin;) will spit the error "g++ not found"
回答3:
I had a situation where my package installs were failing in RStudio because it couldn't find g++.exe. I had installed RTools on a different drive (D:) from my Windows 7 (64-bit) system files (C:). Even though my environment variables were correctly set to point to D, it kept looking for the RTools executables in C. I figured that RStudio was hardcoded to look at [System] which is C. I looked into moving it to D, but it appeared to be more hassle than it was worth (Microsoft stated that it would prevent future upgrades). I wound up reinstalling RTools on the C drive and it solved the problem.
来源:https://stackoverflow.com/questions/18114308/getting-g-error-when-installing-r-code-from-source