[Rcpp-devel] Rcpp and inline, compiler configuration errors, windows 7

2012-07-02 Thread valentin.mans...@laposte.net
Hello everyone,

I hope I am doing the right thing in posting my question here. If no, sorry... 
I've been through the Rcpp FAQ, the Rcpp-Introduction vignette, the Appendix D 
The Windows toolset, and quite a lot of googling but I havn't found a solution 
to my problem.
My final objective is to speed up a script that builds an estimated satellite 
image from three other images. I have factorized everything I could, tried a 
bit of parallel processing, but the script is still too slow so I would like to 
use some C++ inside it to reduce the computing time (using inline() for having 
C++ made functions instead of R-made functions). At the moment, I am just 
trying to run examples of inline(), but it doesn't work.
Using the following example, R gives me error messages (one at he beginning of 
the R-GUI "ouput text", one at the end). Source of the example: 
http://stackoverflow.com/questions/7852520/how-to-make-inline-c-function-calls-in-r

>From what I understand of the error messages, g++ (the compiler, I think) 
>cannot be found. On this thread, someone had a problem that looks like mine, 
>it was a path problem : 
>http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-March/003597.html
When I type "path" on the Windows Command Prompt, I get this :
PATH=C:\R\Rtools\bin;C:\R\Rtools\MinGW\bin;C:\R\R-2.15.1\bin
No spaces in the directory names, I think it should be fine. However, it 
doesn't work. Could the problem come from Cygwin? If yes, do you have a clue on 
how to solve it? If no, could you tell me what I did wrong?

I put sessionInfo() data at the end of my message. My computer runs on windows 
7 enterprise, 32 bits.

Thanks,
Valentin Mansion

### example used : ###
library(Rcpp)
library(inline)
xorig <- c(1, -2, 3, -4, 5, -6, 7)
code <- '
    Rcpp::NumericVector x(xs);
    Rcpp::NumericVector xa = sapply( x, ::fabs );
    return(xa);
    '
xabs <- cxxfunction(signature(xs="numeric"),
    plugin="Rcpp",
    body=code)
xabs(xorig)
### end of example ###

### error message at the begining of output text ###
cygwin warning:
  MS-DOS style path detected: C:/R/R-215~1.1/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/i386/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
g++: not found
make: *** [file146c5ece3f56.o] Error 127
ERROR(s) during compilation: source code errors or compiler configuration 
errors!
### end of error message at the beginning of output text ###

### error message at the end of output text###
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created!
  ###cygwin warning deleted to make the text shorter###
g++: not found
make: *** [file146c5ece3f56.o] Error 127
In addition: Warning message:
running command 'C:/R/R-2.15.1/bin/i386/R CMD SHLIB file146c5ece3f56.cpp 2> 
file146c5ece3f56.cpp.err.txt' had status 1
### end of error message ###


### sessionInfo() ###
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=C   LC_CTYPE=English_Australia.1252    
LC_MONETARY=English_Australia.1252 LC_NUMERIC=C 
[5] LC_TIME=English_Australia.1252   

attached base packages:
[1] tools stats graphics  grDevices utils datasets  methods   
base

other attached packages:
[1] RcppArmadillo_0.3.2.0 inline_0.3.8  Rcpp_0.9.13
### end of sessionInfo ###


Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net
___
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Rcpp and inline, compiler configuration errors, windows 7

2012-07-03 Thread valentin.mans...@laposte.net
Thank you Dirk and Darren for your answers !

I edited the path to redirect it to C:\R\Rtools\gcc-4.6.3\bin (which comes with 
Rtools) instead of C:\R\Rtools\MinGW\bin (which I had installed manually). The 
examples now work ; I still have the cygwin warning but as long as it doesn't 
affect the results it doesn't matter to me.

For the record, here is a summary of the different steps I went through to run 
Rcpp and inline on Windows 7:
.R must be installed in a place that does NOT contain spaces (e.g. 
C:\R\R-2.15.1)
.Rtools must be downloaded (from CRAN), and installed in a place that does NOT 
contain spaces (e.g. C:\R\Rtools).
.The “path variable” must be edited according to the recommendations of the 
Appendix D of "R installation and administration"
-Either using the "path" command in the Windows Command Prompt
-Either using the RedmondPath software, which does the same thing in a more 
user-friendly approach
.The packages Rcpp and inline must be downloaded and loaded into R
 
Useful tips can be found on:
.The Rcpp FAQ http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-FAQ.pdf
.The Appendix D of R installation and administration 
http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset
.Various threads of the Rcpp-devel list 
http://lists.r-forge.r-project.org/pipermail/rcpp-devel/
.This blog page 
http://tonybreyal.wordpress.com/2011/12/07/installing-rcpp-on-windows-7-for-r-and-c-integration/

Now I can begin coding the functions I need to use !

Thank you again for your fast and useful answers.

Valentin


> >> From what I understand of the error messages, g++ (the compiler, I
> >> think) cannot be found. On this thread, someone had a problem that
> >> looks like mine, it was a path problem :
> >> http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-March/003597.html
> 
> Their problem is distinct, in that g++ is being found ('cos it is g++
> that gives their error message).
> However note that their PATH contains:
> C:\R\Rtools\gcc-4.6.3\bin
> 
> Whereas yours does not. So try adding that (but with the correct gcc
> version for your system of course :-)
> 
> Darren


Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net
___
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel