Rainer K. SACHS
2014-Oct-17 18:57 UTC
[R] Microsoft fighting against cxxfunction() and winning
Running Windows 7, 64 bit (but also including, I think, 32 bit R files) RStudio 0.98.501 win-library 3.1 Getting error messages, probably related to add_path, for the following example script; I did look within RStudio and on the internet but can't understand the errors, let alone fix them, so any hints would be appreciated. library(inline) library(Rcpp) library(devtools) f2 <- cxxfunction( signature(x = "integer", y = "numeric" ) , ' return wrap( as<int>(x) * as<double>(y) ) ; ', plugin = "Rcpp" ) fx( 2L, 5 ) # add_path("Rtools\\bin",after=0) # add_path("Rtools\\gcc-4.6.3\\bin",after=1) # get_path() 1) If I run as is, the error message is: Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! Warning message: running command 'make -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file1a2c862738.dll" WIN=64 TCLBIN=64 OBJECTS="file1a2c862738.o"' had status 127 In addition: Warning message: running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB file1a2c862738.cpp 2> file1a2c862738.cpp.err.txt' had status 1 2) If I uncomment the commented lines I get a longer, more interesting, even less comprehensible error message: Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! cygwin warning: MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf CYGWIN environment variable option "nodosfilewarning" turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Syntax error: EOF in backquote substitution make: *** [file20681e531a0b.o] Error 2 Warning message: running command 'make -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file20681e531a0b.dll" WIN=64 TCLBIN=64 OBJECTS="file20681e531a0b.o"' had status 2 In addition: Warning message: running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB file20681e531a0b.cpp 2> file20681e531a0b.cpp.err.txt' had status 1>3) If I try to read cygwin-ug-net/using.html they don't seem to address 64 bit Windows. Any suggestions? Thank you, Ray Sachs
Dirk Eddelbuettel
2014-Oct-18 22:09 UTC
[R] Microsoft fighting against cxxfunction() and winning
On 17 October 2014 at 11:57, Rainer K. SACHS wrote: | Running Windows 7, 64 bit (but also including, I think, 32 bit R files) | RStudio 0.98.501 | win-library 3.1 | | Getting error messages, probably related to add_path, for the | following example script; I did look within RStudio and on the | internet but can't understand the errors, let alone fix them, so any | hints would be appreciated. | | library(inline) | library(Rcpp) | library(devtools) | f2 <- cxxfunction( signature(x = "integer", y = "numeric" ) , ' | return wrap( as<int>(x) * as<double>(y) ) ; | ', plugin = "Rcpp" ) | fx( 2L, 5 ) | # add_path("Rtools\\bin",after=0) | # add_path("Rtools\\gcc-4.6.3\\bin",after=1) | # get_path() 1) Wrong list. This is an Rcpp question; you should ask those on rcpp-devel (where you need to be subscribed to post). 2) You are making your life way too complicated by sticking to a valid, documented (and working, I may add) method which has long been superseeded by Rcpp Attributes). So one really quick way of writing what you spec up there is R> library(Rcpp) R> cppFunction("double f2(int x, double y) { return x * y; }") R> f2( 2L, 5) [1] 10 R> 3) Like some people, I find Windows a little cumbersome due to the need for fiddling for PATH settings and the like -- but there are heuristics that help. If you do the above in RStudio and have, say, not all tools in your path, RStudio will check and tell you so. Give it a try. Hope this helps, and that you find Rcpp helpful. Please bring further questions to the rcpp-devel list. Dirk | | 1) If I run as is, the error message is: | Error in compileCode(f, code, language = language, verbose = verbose) : | Compilation ERROR, function(s)/method(s) not created! Warning message: | running command 'make -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f | "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" | SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' | SHLIB="file1a2c862738.dll" WIN=64 TCLBIN=64 | OBJECTS="file1a2c862738.o"' had status 127 | In addition: Warning message: | running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB | file1a2c862738.cpp 2> file1a2c862738.cpp.err.txt' had status 1 | | 2) If I uncomment the commented lines I get a longer, more | interesting, even less comprehensible error message: | Error in compileCode(f, code, language = language, verbose = verbose) : | Compilation ERROR, function(s)/method(s) not created! cygwin warning: | MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf | Preferred POSIX equivalent is: | /cygdrive/c/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf | CYGWIN environment variable option "nodosfilewarning" turns off this warning. | Consult the user's guide for more details about POSIX paths: | http://cygwin.com/cygwin-ug-net/using.html#using-pathnames | Syntax error: EOF in backquote substitution | make: *** [file20681e531a0b.o] Error 2 | Warning message: | running command 'make -f "C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf" -f | "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" | SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' | SHLIB="file20681e531a0b.dll" WIN=64 TCLBIN=64 | OBJECTS="file20681e531a0b.o"' had status 2 | In addition: Warning message: | running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB | file20681e531a0b.cpp 2> file20681e531a0b.cpp.err.txt' had status 1 | > | | 3) If I try to read cygwin-ug-net/using.html they don't seem to | address 64 bit Windows. | | Any suggestions? Thank you, Ray Sachs | | ______________________________________________ | R-help at r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org