[Rcpp-devel] Rcpp compile question

Dirk Eddelbuettel edd at debian.org
Tue Mar 22 23:33:55 CET 2011


On 22 March 2011 at 14:15, Henry Bee wrote:
| Hi Douglas,
| 
| I assume I do not need to do anything with R after installing RTools?
| I reinstalled RTools and restarted R and got the same errors.

Please see Appendix D of the "R Installation and Administration" manual.
Rcpp is no different than other packages requiring compilation -- you need a
compiler etc properly setup and the manual tells you how to.  

Dirk

| 
| Henry
| 
| On Tue, Mar 22, 2011 at 12:24 PM, Douglas Bates <bates at stat.wisc.edu> wrote:
| 
|     On Tue, Mar 22, 2011 at 2:16 PM, Henry Bee <henry.bee at gmail.com> wrote:
|     > Hi Christian,
|     > Thanks for the source file. Below are the full results as you requested.
|     > It's giving the same error as before. Is 64-bit R supported?
| 
|     64-bit R is supported.  Has it already been established that you have
|     the Rtools (compilers, linkers, etc.) from
|     www.murdoch-sutherland.com/Rtools/ installed?
| 
|     >> source('tmp.R', verbose = TRUE)
|     > 'envir' chosen:<environment: R_GlobalEnv>
|     > encoding = "native.enc" chosen
|     > --> parsed 3 expressions; now eval(.)ing them:
|     >>>>> eval(expression_nr. 1 )
|     >                  =================
|     >> require(inline)
|     > curr.fun: symbol require
|     >  .. after ‘expression(require(inline))’
|     >>>>> eval(expression_nr. 2 )
|     >                  =================
|     >> src <- '
|     > + Rcpp::NumericVector xa(a);
|     > + Rcpp::NumericVector xb(b);
|     > + int n_xa = xa.size(), n_xb = xb.size();
|     > +
|     > + Rcpp::NumericVector xab(n_xa + n_x .... [TRUNCATED]
|     > curr.fun: symbol <-
|     >  .. after ‘expression(src <- '’‘Rcpp::NumericVector
|     > xa(a);’‘Rcpp::NumericVector xb(b);’‘int n_xa = xa.size(), n_xb =
|     > xb.size();’‘’‘Rcpp::NumericVector xab(n_xa + n_xb - 1);’‘for
|     (int i = 0; i <
|     > n_xa; i++)’‘for (int j = 0; j < n_xb; j++)’‘xab[i + j] += xa[i] *
|     > xb[j];’‘return xab;’‘')’
|     >>>>> eval(expression_nr. 3 )
|     >                  =================
|     >> fun <- cxxfunction( signature(a="numeric", b="numeric"), src,
|     >> plugin="Rcpp", verbose=TRUE)
|     >  >> setting environment variables:
|     > PKG_LIBS =
|     >  D:/Users/Henry/Documents/R/win-library/2.12/Rcpp/lib/x64/libRcpp.a
|     >  >> LinkingTo : Rcpp
|     > CLINK_CPPFLAGS =
|     >  -I"D:/Users/Henry/Documents/R/win-library/2.12/Rcpp/include"
|     >  >> Program source :
|     >    1 :
|     >    2 : // includes from the plugin
|     >    3 :
|     >    4 : #include <Rcpp.h>
|     >    5 :
|     >    6 :
|     >    7 : #ifndef BEGIN_RCPP
|     >    8 : #define BEGIN_RCPP
|     >    9 : #endif
|     >   10 :
|     >   11 : #ifndef END_RCPP
|     >   12 : #define END_RCPP
|     >   13 : #endif
|     >   14 :
|     >   15 : using namespace Rcpp;
|     >   16 :
|     >   17 :
|     >   18 : // user includes
|     >   19 :
|     >   20 :
|     >   21 : // declarations
|     >   22 : extern "C" {
|     >   23 : SEXP file5a2532f3( SEXP a, SEXP b) ;
|     >   24 : }
|     >   25 :
|     >   26 : // definition
|     >   27 :
|     >   28 : SEXP file5a2532f3( SEXP a, SEXP b ){
|     >   29 : BEGIN_RCPP
|     >   30 :
|     >   31 : Rcpp::NumericVector xa(a);
|     >   32 : Rcpp::NumericVector xb(b);
|     >   33 : int n_xa = xa.size(), n_xb = xb.size();
|     >   34 :
|     >   35 : Rcpp::NumericVector xab(n_xa + n_xb - 1);
|     >   36 : for (int i = 0; i < n_xa; i++)
|     >   37 : for (int j = 0; j < n_xb; j++)
|     >   38 : xab[i + j] += xa[i] * xb[j];
|     >   39 : return xab;
|     >   40 :
|     >   41 : END_RCPP
|     >   42 : }
|     >   43 :
|     >   44 :
|     > Compilation argument:
|     >  C:\PROGRA~1\R\R-212~1.2/bin/x64/R CMD SHLIB file5a2532f3.cpp 2>
|     > file5a2532f3.cpp.err.txt
|     > ERROR(s) during compilation: source code errors or compiler configuration
|     > errors!
|     > Program source:
|     >   1:
|     >   2: // includes from the plugin
|     >   3:
|     >   4: #include <Rcpp.h>
|     >   5:
|     >   6:
|     >   7: #ifndef BEGIN_RCPP
|     >   8: #define BEGIN_RCPP
|     >   9: #endif
|     >  10:
|     >  11: #ifndef END_RCPP
|     >  12: #define END_RCPP
|     >  13: #endif
|     >  14:
|     >  15: using namespace Rcpp;
|     >  16:
|     >  17:
|     >  18: // user includes
|     >  19:
|     >  20:
|     >  21: // declarations
|     >  22: extern "C" {
|     >  23: SEXP file5a2532f3( SEXP a, SEXP b) ;
|     >  24: }
|     >  25:
|     >  26: // definition
|     >  27:
|     >  28: SEXP file5a2532f3( SEXP a, SEXP b ){
|     >  29: BEGIN_RCPP
|     >  30:
|     >  31: Rcpp::NumericVector xa(a);
|     >  32: Rcpp::NumericVector xb(b);
|     >  33: int n_xa = xa.size(), n_xb = xb.size();
|     >  34:
|     >  35: Rcpp::NumericVector xab(n_xa + n_xb - 1);
|     >  36: for (int i = 0; i < n_xa; i++)
|     >  37: for (int j = 0; j < n_xb; j++)
|     >  38: xab[i + j] += xa[i] * xb[j];
|     >  39: return xab;
|     >  40:
|     >  41: END_RCPP
|     >  42: }
|     >  43:
|     >  44:
|     > Error in compileCode(f, code, language = language, verbose = verbose) :
|     >   Compilation ERROR, function(s)/method(s) not created!
|     > In addition: Warning message:
|     > running command 'C:\PROGRA~1\R\R-212~1.2/bin/x64/R CMD SHLIB
|     > file5a2532f3.cpp 2> file5a2532f3.cpp.err.txt' had status 1
|     >>
|     >
|     >
|     > 2011/3/21 Christian Gunning <icos.atropa at gmail.com>
|     >>
|     >> "Here's the command:"
|     >>
|     >> Works for me.  Try sourcing the attached file (which includes your
|     >> command, +verbose=T), and post back the *full* results, including the
|     >> source('tmp.R.txt') command and the next prompt line.
|     >>
|     >> -christian
|     >>
|     >> --
|     >> A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
|     >
|     >
|     > _______________________________________________
|     > Rcpp-devel mailing list
|     > Rcpp-devel at lists.r-forge.r-project.org
|     > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
|     >
|     >
| 
| 
| 
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list