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

查看:11
本文介绍了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.4mingw_32in中找到gcc,也就是系统PATH中指定的位置;strsplit(Sys.getenv('PATH'), ';') 给出

I want R to find gcc in C:Rtools-3.4mingw_32in, 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天全站免登陆