Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

c++ - Rcpp Rtools installed but error message g++ 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:WORKRtoolsinmake.exe

When I run

 system('g++ -v')

I get:

 Using built-in specs.
 COLLECT_GCC=C:WORKRtoolsGCC-46~1.3inG__~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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The path c:/Rtools/mingw_64/bin/ is hard-coded into the file Makeconflocated somewhere in the R installation (in my case C:ProgsRR-3.4.1etcx64), 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...