Rcpp Rtools installed but error message g++ not found

install rtools
warning: rtools is required to build r packages but is not currently installed
rbuildtools
package rtools is not available (for r version 3.6 2)
uninstall rtools
rstudio warning in system(cmd) : 'make' not found
rstudio not seeing rtools
rcpp in system cmd make not found

I have consulted existing entries on SO related to my specific issue, but still could not resolve it.

I am trying to do this with my machine at work, where I have limited admin rights, but I can run Rtools.exe, so I installed it.

My setup for R is:

 platform       x86_64-w64-mingw32          
 arch           x86_64                      
 os             mingw32                     
 system         x86_64, mingw32             
 version.string R version 3.3.0 (2016-05-03)

I am RStudion Version 0.99.902. I installed Rtools version 3.3.0.1959.

All of R, Rstudio, and Rtools are installed in C:/WORK/, which is where I have some limited admin rights.

In my system ENV variable, I have set up:

 C:\\WORK\\Rtools\\bin; C:\\WORK\\Rtools\\gcc-  4.6.3\\bin; C:\\WORK\\R-3.3.0\\bin\\x64;" 

When I run

 system('where make')

I get

 C:\WORK\Rtools\bin\make.exe

When I run

 system('g++ -v')

I get:

 Using built-in specs.
 COLLECT_GCC=C:\WORK\Rtools\GCC-46~1.3\bin\G__~1.EXE
 COLLECT_LTO_WRAPPER=c:/WORK/rtools/gcc-46~1.3/bin/../libexec/gcc/i686-w64-   mingw32/4.6.3/lto-wrapper.exe
 Target: i686-w64-mingw32
 Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with-gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpc=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --disable-shared --enable-static --enable-targets=all --enable-languages=c,c++,fortran --enable-libgomp --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-nls --disable-werror --enable-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS='-O2 -mtune=core2 -fomit-frame-pointer' LDFLAGS=
 Thread model: win32
 gcc version 4.6.3 20111208 (prerelease) (GCC) 

When I compile, I get this error:

 Error in compileCode(f, code, language = language, verbose = verbose) : 
 Compilation ERROR, function(s)/method(s) not created!
 c:/Rtools/mingw_64/bin/g++: not found

My question is: why is R still looking for g++ in

 c:/Rtools/mingw_64/bin/g++

Didn't I already set R to look for it in

 C:/WORK/Rtools? 

Even when I manually added

 c:/WORK/Rtools/mingw_64/bin/g++

in the ENV variable, I still got the same error. (I cannot make Rtools folder in C:/ due to admin rights.)

Has anyone run into this specific issue?

The path c:/Rtools/mingw_64/bin/ is hard-coded into the file Makeconflocated somewhere in the R installation (in my case C:\Progs\R\R-3.4.1\etc\x64), as the value of the variable BINPREF.

The easiest thing to do is to change this path to your path C:/WORK/Rtools/bin (in my case was C:/Progs/RTools/3.4/mingw_64/bin/). That worked for me in a fresh installation of R-3.4.1 and Rtools3.4, and a minimal example.

RStudio do not find Rtools and offer to install even if already , I try to look into Rstudio code source but not easy for me yet. an error if we use the rtools installer from Rstudio that install the rtools binary in c:/Rbuildtools . Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1) remotes 2.0.2 2018-10-30 [1] -o RcppExports.o C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

What is happening is the need to be on RTools 34 and NOT 33 for R 3.3.x.

Remove the rtools install and then follow the guide here:

http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/

@David, you need to remove all instances of C:\WORK\Rtools\<something> and any duplicates (e.g. C:\WORK\R-3.3.0\bin\x64 appears twice.) Then add:

c:\WORK\Rtools\bin; c:\WORK\Rtools\mingw_32\bin;

Rcpp looking for Rtools in wrong place · Issue #545 · RcppCore , kendonB opened this issue on Aug 27, 2016 · 6 comments -c tmp.cpp -o tmp.o C:/Rtools-3.3/mingw_64/bin/g++: not found make: *** [tmp.o] Error 127 Warning message: It's looking in C:/Rtools-3.3 but Rtools gets installed in C:/Rtools. Note that there are new potential kinds of problems (from R 3.3 onwards), since R (not RStudio, but R) adds a BINPREF variable and modifies the Path variable by default, see the Renviron.site file for the latter, on Windows typically e.g. under C:\Program Files\R\R-3.4.3\etc:

A plausible and easy way to do this is to choose "Full installation to build 32 or 64 bit" in the following promp.

Installation of Rstan - RStan, I have Rstan installed on Linux, but wanted to install it on Windows today. I followed the Rcpp Rtools installed but error message g++ not found. c++, g++,​  It's looking in C:/Rtools-3.3 but Rtools gets installed in C:/Rtools. Additionally, when I'm working in Rstudio, it prompts me to install additional tools and it installs another copy of Rtools in RBuildTools, which also doesn't get picked up by sourceCpp.

Running rstan with latest R (3.6.0) fails with Error in compileCode , I've just clean installed the latest R version, released today on CXX14 = “C:\​Rtools\mingw_64\bin\g++.exe” -m$(WIN) -std=c++1y Compilation ERROR, function(s)/method(s) not created! sh: g++: command not found and all of the Rcpp packages and inserted the suggested text, but this does not help. Hi there, I have just downloaded RStudio and installed the two packages clang.7.0.0 and gfortran-6.1.pkg on my Mac (iOS Catalina) 10.15. However, when trying to install any further package in RStudio I seem to run into &hellip;

How to Fix Compilation Failure on Windows · Parallel Analog , If you've got the following error on Windows when installing the RAnEn package: -DNDEBUG -I"C:/Users/student/Documents/R/R-3.2.2/library/Rcpp/include" -​O2 -Wall -mtune=core2 -c AnEn.cpp -o AnEn.o sh: g++: command not found First, whether you have installed the correct version of Rtools that  Unfortunately, it does not work on Windows: devtools::install_github ("r-lib/pkgbuild") fails because the CRAN version of devtools does not accept either R 3.5 nor Rtools 3.5 to compile it. We need a binary of pkgbuild on CRAN first to allow using Rtools. I went back to R 3.4.4 and Rtools 3.4 until pkgbuild is on CRAN.

Using Rtools40 on Windows, Starting with R 4.0.0 (released April 2020), R for Windows uses a brand new the precompiled “binary packages” from CRAN, for which you do not need rtools! that make can be found, which should show the path to your Rtools installation. Hello, I got the following message while trying to install DADA2 on R3.3.1 (Windows7) using the devtools method: The downloaded binary packages are in C:\Users\torti\AppData\Local\Temp\RtmpkX86oo\d

Comments
  • Sys.getenv()['PATH'] gives C:\WORK\R-3.3.0\bin\x64; C:\WORK\Rtools\bin; C:\WORK\Rtools\mingw_64\bin; C:\WORK\Rtools\bin; C:\WORK\Rtools\mingw_32\bin; C:\WORK\R-3.3.0\bin\x64; C:\WINDOWS\system32; C:\WINDOWS; C:\WINDOWS\System32\Wbem; C:\Program Files (x86)\Microsoft Office\Office14; C:\WINDOWS\System32\WindowsPowerShell\v1.0\; Sys.getenv()['PATH'] C:\APPS\Global\dev_tools;C:\Program Files (x86)\Enterprise Vault\EVClient\; C:\WORK\TortoiseSVN\bin; C:\WORK\Rtools\bin; C:\WORK\Rtools\mingw_64\bin; C:\WORK\R-3.3.0\bin\x64
  • Modifying Makeconf file should be included as a step in updating Rtools
  • Especially since it is installed in RBuildTools directory by default. Thank you!
  • The page at cran.r-project.org/bin/windows/Rtools mentions Rtools3.3 to R 3.2.* and R 3.3.*, and Rtools3.4 for R 3.3.* and up, implying a choice. So OP may just have a PATH issue?
  • I uninstalled Rtools33 and installed Rtools34. I still got the same error message: "Compilation ERROR, function(s)/method(s) not created! c:/Rtools/mingw_64/bin/g++: not found". I still can't get R to look for "Rtools/mingw_64/bin" in the place I installed even though I added the path in the ENV variable's PATH.
  • Please add the output from the following to your post above: Sys.getenv()['PATH']
  • @DirkEddelbuettel , I've had better luck on Windows builds associating R with the latest RTools. You are correct in this case that it is definitely a path issue.
  • The newest version of Rtools actually constructs paths to the gcc / g++ compilers on demand; you now only need Rtools\bin on the PATH. When make.exe is called, R will then effectively tell it to look for gcc at ..\mingw_64\bin\gcc.exe (assuming 64bit Windows). Note that the directories Rtools\mingw_32 and Rtools\mingw_64 should be populated by default by the new Rtools installers.