1

I want do build a dll file and later use this functionality with dyn.load(). So, I run R CMD SHLIB my_code.c in the command line.

Rtools default directory is c:\Rtools. When installed here, it works fine. The windows environment path has the following entries:

c:\Rtools\bin;c:\Rtools\mingw_64\bin;K:\sw\R\R-3.4.1\bin\x64

This is the recommended path as in Appendix D from the R Installation and Administration manual (https://cran.r-project.org/doc/manuals/r-devel/R-admin.html).

But in my PC I like to install software in another place. But then, Rtools just does not work. Of course, I update the PATH variable, but even so.

K:\sw\Rtools\Rtools34\bin;k:\sw\Rtools\Rtools34\mingw_64\bin;K:\sw\R\R-
3.4.1\bin\x64

When I install Rtools in another place that is not c:\Rtools (like the above path), it reports

c:/Rtools/mingw_64/bin/gcc: not found

So, although I have change the path variable, it still wants to find Rtools in the default directory.

Is it possible to change the default directory of Rtools?

Eduardo
  • 2,405
  • 3
  • 14
  • 19
  • you can run `devtools::find_rtools()` before you need Rtools – Stéphane Laurent Sep 09 '17 at 18:33
  • or set the environment variable `BINPREF` to `"path/to/Rtools/mingw_$(WIN)/bin/"` – Stéphane Laurent Sep 09 '17 at 18:35
  • Pherhaps my question is not clear and I should rephrase it.I want do build a `dll` file and later use this functionality with `dyn.load()`. When I run `R CMD SHLIB my_code.c` I got the error `c:/Rtools/mingw_64/bin/gcc: not found` – Eduardo Sep 09 '17 at 23:17
  • I think it should work if you add the setting changes of this answer https://stackoverflow.com/a/44035904/4468078 to your Rprofile.site file so that the R session is initialized when started and "points" to the right RTools location... – R Yoda Jan 03 '18 at 09:40

0 Answers0