[Rd] Setting the path to Rtools for package compilation on Windows

Jeroen Ooms jeroenooms at gmail.com
Tue Feb 13 11:20:58 CET 2018

On Tue, Feb 13, 2018 at 7:45 AM, Peter Langfelder
<peter.langfelder at gmail.com> wrote:
> Hi all,
> I'm trying to set up the Windows Rtools toolset for building packages
> with compiled code. I installed for Windows R-3.4.3 from CRAN and
> installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
> M:\R\Rtools-3.4
> Following the instructions, in shell, I set
> Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-3.4.3\bin;...
> (the ... are other paths irrelevant for R/Rtools).

Thanks for your question. Your logs show that 'gcc' is not found. As
of R 3.3 you need to set the path to the compiler using the BINPREF
variable. This is because we ship two separate versions of gcc, one
targeting win32 and one targeting win64. I am not sure what your
rtools installation looks like, but could you try setting this
environment variable:


I think this will do the job.

On Tue, Feb 13, 2018 at 10:21 AM, Tomas Kalibera
<tomas.kalibera at gmail.com> wrote:
> Thanks for the report - this has been already reported as bug 17376, it is
> caused by scripts that build the Windows binaries and by now has been fixed
> in R-patched and R-devel snapshot builds. So as a solution that works now I
> would recommend using R-patched.

This issue is unrelated, I doubt your advice will solve anything. The
only thing that 17376 does is add c:/rtools/bin to the default path.
But this dir does not exist for this user, so it is ignored by windows
when searching the PATH.

More information about the R-devel mailing list