R CMD检查不在Rtools目录中寻找gcc [英] R CMD check not looking for gcc in Rtools directory

查看:165
本文介绍了R CMD检查不在Rtools目录中寻找gcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R一直在安装软件包,但是突然–我想不到我修改或卸载的任何相关软件– 当我在命令提示符下运行R CMD check或在R控制台中运行devtools::check()时,它找不到gcc;它会出现以下错误:

R has been installing packages just fine, but suddenly – I can't think of anything relevant that I modified or uninstalled – it can't find gcc when I run R CMD check in the command prompt, or devtools::check() in the R console; it delivers the following error:

* installing *source* package 'PkgName' ...
** libs
C:/MinGW/bin/gcc  -I"C:/PROGRA~1/R/R-34~1.2/include" -DNDEBUG     -I"d:/Compiler/gcc-4.9.3/local330/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c PkgName-init.c -o PkgName-init.o
C:/MinGW/bin/gcc: not found

我希望R在C:\ Rtools-3.4 \ mingw_32 \ bin中找到gcc,这是在系统PATH中指定的位置; strsplit(Sys.getenv('PATH'), ';')给出

I want R to find gcc in C:\Rtools-3.4\mingw_32\bin, which is the location specified in the system PATH; strsplit(Sys.getenv('PATH'), ';') gives

[...]
[4] "c:\\Rtools-3.4\\bin"                                                                                
[5] "c:\\Rtools-3.4\\mingw_32\\bin"                                                                      
[7] "C:\\Program Files\\R\\R-3.4.2\\bin\\i386"                                                           
[8] "C:\\Program Files\\R\\R-3.4.2\\bin"                                                                 
[9] "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\"                                                  
[...]

如何告诉R不要在不存在的目录C:\ MinGW中查找,而是遵循PATH?

How can I tell R not to look in the non-existent directory C:\MinGW, and instead to follow the PATH?

我不想在此安装第二个MinGW副本,因为这会导致其他问题.

I don't want to install a second copy of MinGW there, as this causes other issues.

推荐答案

R使用BINPREF变量查找可执行文件: gcc可执行文件的位置由CC = $(BINPREF)gcc $(M_ARCH)

R uses a BINPREF variable to locate executables: the location of the gcc executable is given by CC = $(BINPREF)gcc $(M_ARCH)

在我的情况下,BINPREF是由C:/Users/MYUSERNAME/Documents/.R/Makevars设置的.删除此文件的内容会删除错误的位置.

In my case, BINPREF was being set by C:/Users/MYUSERNAME/Documents/.R/Makevars. Deleting the contents of this file removed the incorrect location.

还值得检查文件$RPATH/etc/i386/Makeconf,它将在每次新安装R时重新创建.请注意以下行 BINPREF ?= c:/Rtools/mingw_32/bin/,它(通过?=运算符)将设置BINPREF的值(如果尚未设置的话),就像在上述Makevars文件中一样.

It is also worth checking the file $RPATH/etc/i386/Makeconf, which will be re-created with each new installation of R. Note the line BINPREF ?= c:/Rtools/mingw_32/bin/, which (via the ?= operator) will set the value of BINPREF if it is not already set, as it was in the Makevars file mentioned above.

这篇关于R CMD检查不在Rtools目录中寻找gcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆