1

My Problem

I installed Rtools and added the path to my PATH variable:

mPath <- strsplit(Sys.getenv("PATH"), ";")[[1]]
mPath[grep("Rtools", mPath)]
# [1] "C:\\Temp\\Rtools\\bin"              "C:\\Temp\\Rtools\\gcc-4.6.3\\bin"  
# [3] "C:\\Temp\\Rtools\\gcc-4.6.3\\bin32" "C:\\Temp\\Rtools\\mingw_32\\bin"

(So you can see it is not installed directly at c:\Rtools)

When I try to run a simple Rcpp snippet, I get the following error:

library(Rcpp)
evalCpp("1+1")

[...]

c:/Rtools/mingw_32/bin/g++: not found

So basically Rcpp is looking in C:/Rtools ignoring my PATH variable.

Workaround

If I run

library(installr)
install.Rtools()

Loading required namespace: devtools

No need to install Rtools - You've got the relevant version of Rtools installed

and then run evalRcpp("1+1") again, everything works as expected.

My Question

Why does it not work right away? How do I tell Rcpp to look in the right folder? How does install.Rtools manage to convince Rcpp to look into the right folder? How can I achieve that without the workaround?

thothal
  • 16,690
  • 3
  • 36
  • 71
  • 1
    We have nothing to do with `install.Rtools()`; talk to its authors. We recommend to follow the instructions in [R Installation and Administration](https://cran.r-project.org/doc/manuals/r-release/R-admin.html), particularly the relevant appendices, and _to the letter_. Also note IIRC there was a regression a few R releases ago. You may now _have to_ install into `C:/Rtools`. – Dirk Eddelbuettel Feb 20 '18 at 13:22
  • 1
    This is exactly the issue @DirkEddelbuettel. You _really_ cannot have a custom path with modifying the local `Makevars` file. – coatless Feb 20 '18 at 15:55
  • You used to in the path though. – Dirk Eddelbuettel Feb 20 '18 at 15:56
  • 1
    The `PATH` variable is required. But, there is a hardcoded path for the binary that gets picked up as well. It's a long story. Remind me at the end of the week and I'll write up an addendum for the _Rtools_ post. – coatless Feb 21 '18 at 03:59
  • I have the same problem. Rcpp is looking in `C:/Rtools/3.4` even though I am using RTools35 and it's installed in `C:/Rtools/`, which is in `PATH` as required. – Simon Woodward Aug 21 '18 at 20:17
  • `WARNING: Rtools 3.5 found on the path at C:/Rtools is not compatible with R 3.5.1.` – Simon Woodward Aug 21 '18 at 20:37
  • try Makeconf file: https://stackoverflow.com/questions/39090983/rcpp-rtools-installed-but-error-message-g-not-found – user3226167 Jan 07 '20 at 08:42

1 Answers1

0

Had the same problem. The system is not (yet) compatible with Rtools 3.5. Also, there seems to be an issue that they re-named it to RBuildTools instead of RTools. Install the former version 3.4 on https://cran.r-project.org/bin/windows/Rtools/. This did the job for me!

Lucky Luke
  • 21
  • 2