1

在 Windows 10 Education 64 位上,我在 RStudio 版本 1.2.1335 中运行 R 版本 3.6.0 和 Rtools 3.5.0。当我尝试安装时收到以下错误devtools::install_github("RcppCore/Rcpp")

> devtools::install_github("RcppCore/Rcpp")
Downloading GitHub repo RcppCore/Rcpp@master
√  checking for file 'C:\Users\mat\AppData\Local\Temp\RtmpCSoh75\remotesb542b002bf2\RcppCore-Rcpp-6062d56/DESCRIPTION' (856ms)
-  preparing 'Rcpp': (5.8s)
√  checking DESCRIPTION meta-information
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts (822ms)
-  checking for empty or unneeded directories (4.8s)
-  building 'Rcpp_1.0.1.3.tar.gz' (389ms)
   Warning: file 'Rcpp/cleanup' did not have execute permissions: corrected

Installing package into ‘C:/Users/mat/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'Rcpp' ...
** using staged installation
** libs

*** arch - i386
C:/Rtools/bin/g++  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I../inst/include/         -O2 -Wall  -mtune=generic -c api.cpp -o api.o
sh: C:/Rtools/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.0/etc/i386/Makeconf:215: api.o] Error 127
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/Users/mat/Documents/R/win-library/3.6/Rcpp'
* restoring previous 'C:/Users/mat/Documents/R/win-library/3.6/Rcpp'

要重现此代码:

>install.packages("devtools")
>library("devtools")
>options(buildtools.check = NULL)
>install.packages("Rcpp", dep = TRUE)
>devtools::install_github("RcppCore/Rcpp")

我的系统路径是这样开始的:

>Sys.getenv()['PATH']
PATH                           
        C:\Program 
Files\R\R-3.6.0\bin\x64;C:\Rtools\bin;C:\Rtools\mingw_32\bin;C:\Rtools\mingw_64\bin;

Program 和 Files 之间有一个空格

作为管理员,我将Makeconf32 位和 64 位文件夹中的通过记事本更改为:BINPREF ?= D:/Rtools/mingw_32/bin/BINPREF ?= D:/Rtools/mingw_64/bin/

我试过这个链接来修复 Makeconf 文件: Rcpp Rtools installed but error message g++ not found

对于 Rcpp 编译问题,此链接似乎很有帮助: Cannot compile from source with Rcpp on Windows 7

这是否与注释掉 rpp 标签或更改 Makevars 或 Makeconf 中的某些变量有关?如果不是,为什么代码devtools::install_github("RcppCore/Rcpp")会在错误的 bin 中查找 g++?它在里面寻找它

C:/Rtools/bin/g++

如你看到的。

将 g++.exe 复制并粘贴到 > C:/Rtools/bin/g++ 后,我收到另一个错误:

>devtools::install_github("RcppCore/Rcpp")
    Downloading GitHub repo RcppCore/Rcpp@master
    √  checking for file 'C:\Users\mat\AppData\Local\Temp\RtmpCSoh75\remotesb54764929a4\RcppCore-Rcpp-6062d56/DESCRIPTION' (916ms)
    -  preparing 'Rcpp': (5.7s)
    √  checking DESCRIPTION meta-information ... 
    -  cleaning src
    -  checking for LF line-endings in source and make files and shell scripts (986ms)
    -  checking for empty or unneeded directories (3.8s)
    -  building 'Rcpp_1.0.1.3.tar.gz' (352ms)
       Warning: file 'Rcpp/cleanup' did not have execute permissions: corrected

    Installing package into ‘C:/Users/mat/Documents/R/win-library/3.6’
    (as ‘lib’ is unspecified)
    * installing *source* package 'Rcpp' ...
    ** using staged installation
    ** libs

    *** arch - i386
    C:/Rtools/bin/g++  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I../inst/include/         -O2 -Wall  -mtune=generic -c api.cpp -o api.o
    Cannot create temporary file in C:\Users\mat\AppData\Local\Temp\: Permission denied
    make: *** [C:/PROGRA~1/R/R-36~1.0/etc/i386/Makeconf:215: api.o] Error 3
    ERROR: compilation failed for package 'Rcpp'
    * removing 'C:/Users/mat/Documents/R/win-library/3.6/Rcpp'
    * restoring previous 'C:/Users/mat/Documents/R/win-library/3.6/Rcpp'

我不认为复制 g++.exe 是正确的方法。但是,值得一试,并且可能会导致正确的答案。请帮忙。(如果您devtools::install_github("RcppCore/Rcpp")连续运行,您需要删除 ~/R/win-library/3.6 中的锁定文件夹(00LOCK-Rcpp)以避免ERROR: failed to lock directory)谢谢!

4

0 回答 0