rwinlib / gcc-4.9.3

Building R for Windows with the new gcc 4.9.3 toolchain
28 stars 7 forks source link

Unnormal Call for Rtools from Rcmd #11

Open Hz-EMW opened 7 years ago

Hz-EMW commented 7 years ago

Dear Maintainers: I am a new user of Rtools, I’m sorry to bothering you for the odds I encountered during package compiling. However, I still can’t find way out after learned every materials I could get about this and asked online. So you are my last hope. I tried to compile new version of text2vec. I install Rtools3.4 on my system in D:\Rtools directory, and let it write system path. but I still couldn’t compile the text2vec-0.4 package. When I run Rcmd, it find g++ in “c:/Rtools/”. But all my set in system path is right, this is the message of compiling:

>"D:\Program Files\R\R-3.3.1\bin\x64\rcmd.exe" INSTALL --build E:\packbuild\text2vec-0.4
* installing to library 'D:/Program Files/R/R-3.3.1/library'
* installing *source* package 'text2vec' ...
** libs
c:/Rtools/mingw_64/bin/g++  -std=c++0x -I"D:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG    -I"D:/Program Files/R/R-3.3.1/library/Rcpp/include"
 -I"D:/Program Files/R/R-3.3.1/library/RcppParallel/include"
 -I"D:/Program Files/R/R-3.3.1/library/digest/include" -I"d:/Compiler/gcc-4.9.3/local330/include"  -DRCPP_PARALLEL_USE_TBB=1   -O2 -Wall  -mtune=core2 -c GloveFitter.cpp -o GloveFitter.o
c:/Rtools/mingw_64/bin/g++: not found
make: *** [GloveFitter.o] Error 127
Warning: 'make -f "Makevars.win" -f "D:/PROGRA~1/R/R-33~1.1/etc/x64/Makeconf" -f
 "D:/PROGRA~1/R/R-33~1.1/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXF
LAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1X
LDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="text2vec.dll" WIN=64 TCLBIN=64 OBJE
CTS="GloveFitter.o HashCorpus.o RcppExports.o VocabCorpus.o Vocabulary.o gibbs.o
 matrix_utils.o uint_hash.o utils.o"'2
ERROR: compilation failed for package 'text2vec'
* removing 'D:/Program Files/R/R-3.3.1/library/text2vec'
* restoring previous 'D:/Program Files/R/R-3.3.1/library/text2vec'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
D:\Program Files\R\R-3.3.1\library\00LOCK-text2vec-0.4\text2vec\libs\x64\text2vec.dll
D:\Program Files\R\R-3.3.1\library\text2vec\libs\x64\text2vec.dll
Permission denied

I asked this question on stackoverflow, but didn’t get the solution. So I build the mirror directory of Rtools in drive C and copy the g++ into it. However, it doesn’t work and “rcmd” call another tool----“gcc” in "d:/Compiler/gcc-4.9.3/local330/include" at this time. In fact, gcc is in the same directory with g++, in the “D:/Rtools/mingw_64/bin/”. Rcmd call the tools of Rtools in different directories, what should I do for this? (following message gathered after I copy g++ into c:/Rtools/mingw_64/bin/)

>"D:\Program Files\R\R-3.3.1\bin\x64\rcmd.exe" INSTALL --build E:\packbuild\text2vec-0.4
* installing to library 'D:/Program Files/R/R-3.3.1/library'
* installing *source* package 'text2vec' ...
** libs
c:/Rtools/mingw_64/bin/g++  -std=c++0x -I"D:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG    -I"D:/Program Files/R/R-3.3.1/library/Rcpp/include"
 -I"D:/Program Files/R/R-3.3.1/library/RcppParallel/include"
 -I"D:/Program Files/R/R-3.3.1/library/digest/include"
 -I"d:/Compiler/gcc-4.9.3/local330/include"  -DRCPP_PARALLEL_USE_TBB=1   -O2 -Wall  -mtune=core2 -c GloveFitter.cpp -o GloveFitter.o
g++.exe: error: CreateProcess: No such file or directory
make: *** [GloveFitter.o] Error 1
Warning: 'make -f "Makevars.win" -f "D:/PROGRA~1/R/R-33~1.1/etc/x64/Makeconf" -f
 "D:/PROGRA~1/R/R-33~1.1/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXF
LAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1X
LDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="text2vec.dll" WIN=64 TCLBIN=64 OBJE
CTS="GloveFitter.o HashCorpus.o RcppExports.o VocabCorpus.o Vocabulary.o gibbs.o
 matrix_utils.o uint_hash.o utils.o"'2
ERROR: compilation failed for package 'text2vec'
* removing 'D:/Program Files/R/R-3.3.1/library/text2vec'
* restoring previous 'D:/Program Files/R/R-3.3.1/library/text2vec'

I wonder if you could give me some advice on package compiling with Rtools. I would be most grateful if you could reply at your earliest convenience. Looking forward to hearing from you. Thank you very much. Sincerely yours Humphrey Zhao

jeroen commented 7 years ago

The best way is to use devtools package:

install.packages("devtools")

After that you can use install form cran or github:

install_cran('text2vec')
install_github('dselivanov/text2vec')
dselivanov commented 7 years ago

@jeroenooms actually seems the problem is in non standard Rtools installation.

Hz-EMW commented 7 years ago

On the one hand, I only change the install directoty from "c:\Rtools" to "D:\Rtools", and no other change(to reduce the space ocupation in system drive). On the other hand, I have only PCs with Windows7 and Windows8.1 OS, devtools couldn't run on it(devtools will prompt to use Rtools). Now I'm using Rtools3.4, would it be better if I change into Rtools3.3?

jeroen commented 7 years ago

Is gcc in your path?

Hz-EMW commented 7 years ago

I'm using the default setting in the path, they are "D:\Rtools\bin" and "D:\Rtools\mingw_64\bin". The latter one has changed into "mingw_64" to fit my 64bit OS, otherwise, it may not work after compile. And gcc is in the latter route "D:\Rtools\mingw_64\bin".

dselivanov commented 7 years ago

@Hz-EMW I will release 0.4 on CRAN soon (first week of October).

jeroen commented 7 years ago

If you want to override the location of your compiler you need to set the BINPREF environment variable. See here for how devtools does it.