RcppArmadillo compilation error: R CMD SHLIB returns status 1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RcppArmadillo compilation error: R CMD SHLIB returns status 1

Paul Viefers
Dear all,

running the example by D. Eddebuettel (http://dirk.eddelbuettel.com/blog/2011/04/23/) I get an error message. Specifically, the R code I was taking from the above example is

### BEGIN EXAMPLE ###

suppressMessages(require(RcppArmadillo))
suppressMessages(require(Rcpp))
suppressMessages(require(inline))
code <- '
   arma::mat coeff = Rcpp::as<arma::mat>(a);
   arma::mat errors = Rcpp::as<arma::mat>(e);
   int m = errors.n_rows; int n = errors.n_cols;
   arma::mat simdata(m,n);
   simdata.row(0) = arma::zeros<arma::mat>(1,n);
   for (int row=1; row<m; row++) {
     simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
   }
   return Rcpp::wrap(simdata);
 '
## create the compiled function
rcppSim <- cxxfunction(signature(a="numeric",e="numeric"),
                        code,plugin="RcppArmadillo")

### END OF EXAMPLE ###

Executing this inside R, returned the following:

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
  1:
  2: // includes from the plugin
  3: #include <RcppArmadillo.h>
  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 file33765791( SEXP a, SEXP e) ;
 24: }
 25:
 26: // definition
 27:
 28: SEXP file33765791( SEXP a, SEXP e ){
 29: BEGIN_RCPP
 30:
 31:    arma::mat coeff = Rcpp::as<arma::mat>(a);
 32:    arma::mat errors = Rcpp::as<arma::mat>(e);
 33:    int m = errors.n_rows; int n = errors.n_cols;
 34:    arma::mat simdata(m,n);
 35:    simdata.row(0) = arma::zeros<arma::mat>(1,n);
 36:    for (int row=1; row<m; row++) {
 37:      simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
 38:    }
 39:    return Rcpp::wrap(simdata);
 40:  
 41: END_RCPP
 42: }
 43:
 44:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created!
Executing command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD SHLIB file33765791.cpp 2> file33765791.cpp.err.txt' returned status 1

I am working under R 2.14.0 and as the pros among you might guess, I am new to using the C++ interfaces within R. I think all I have to do is to edit some settings on my Windows 7 machine here, but the error message is too cryptic to me. Alas, I could also not find any thread or help topic that deals with this online. I appreciate any direct reply or reference where I can find a solution to this.
Please let me know in case I am leaving out some essential details here.

Many thanks,
Paul
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: RcppArmadillo compilation error: R CMD SHLIB returns status 1

Duncan Murdoch-2
On 05/12/2011 1:22 PM, Paul Viefers wrote:

> Dear all,
>
> running the example by D. Eddebuettel (http://dirk.eddelbuettel.com/blog/2011/04/23/) I get an error message. Specifically, the R code I was taking from the above example is
>
> ### BEGIN EXAMPLE ###
>
> suppressMessages(require(RcppArmadillo))
> suppressMessages(require(Rcpp))
> suppressMessages(require(inline))
> code<- '
>     arma::mat coeff = Rcpp::as<arma::mat>(a);
>     arma::mat errors = Rcpp::as<arma::mat>(e);
>     int m = errors.n_rows; int n = errors.n_cols;
>     arma::mat simdata(m,n);
>     simdata.row(0) = arma::zeros<arma::mat>(1,n);
>     for (int row=1; row<m; row++) {
>       simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
>     }
>     return Rcpp::wrap(simdata);
>   '
> ## create the compiled function
> rcppSim<- cxxfunction(signature(a="numeric",e="numeric"),
>                          code,plugin="RcppArmadillo")
>
> ### END OF EXAMPLE ###
>
> Executing this inside R, returned the following:
>
> ERROR(s) during compilation: source code errors or compiler configuration errors!
>
> Program source:
>    1:
>    2: // includes from the plugin
>    3: #include<RcppArmadillo.h>
>    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 file33765791( SEXP a, SEXP e) ;
>   24: }
>   25:
>   26: // definition
>   27:
>   28: SEXP file33765791( SEXP a, SEXP e ){
>   29: BEGIN_RCPP
>   30:
>   31:    arma::mat coeff = Rcpp::as<arma::mat>(a);
>   32:    arma::mat errors = Rcpp::as<arma::mat>(e);
>   33:    int m = errors.n_rows; int n = errors.n_cols;
>   34:    arma::mat simdata(m,n);
>   35:    simdata.row(0) = arma::zeros<arma::mat>(1,n);
>   36:    for (int row=1; row<m; row++) {
>   37:      simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
>   38:    }
>   39:    return Rcpp::wrap(simdata);
>   40:
>   41: END_RCPP
>   42: }
>   43:
>   44:
> Error in compileCode(f, code, language = language, verbose = verbose) :
>    Compilation ERROR, function(s)/method(s) not created!
> Executing command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD SHLIB file33765791.cpp 2>  file33765791.cpp.err.txt' returned status 1
>
> I am working under R 2.14.0 and as the pros among you might guess, I am new to using the C++ interfaces within R. I think all I have to do is to edit some settings on my Windows 7 machine here, but the error message is too cryptic to me. Alas, I could also not find any thread or help topic that deals with this online. I appreciate any direct reply or reference where I can find a solution to this.
> Please let me know in case I am leaving out some essential details here.

If you put the program source into a file (e.g. fn.cpp) and in a Windows
cmd shell you run

R CMD SHLIB fn.cpp

what do you get?   I would guess you've got a problem with your setup of
the compiler or other tools, and this would likely show it.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: RcppArmadillo compilation error: R CMD SHLIB returns status 1

Douglas Bates-2
On Dec 6, 2011 8:30 AM, "Duncan Murdoch" <[hidden email]> wrote:
>
> On 05/12/2011 1:22 PM, Paul Viefers wrote:
>>
>> Dear all,
>>
>> running the example by D. Eddebuettel (
http://dirk.eddelbuettel.com/blog/2011/04/23/) I get an error message.
Specifically, the R code I was taking from the above example is

>>
>> ### BEGIN EXAMPLE ###
>>
>> suppressMessages(require(RcppArmadillo))
>> suppressMessages(require(Rcpp))
>> suppressMessages(require(inline))
>> code<- '
>>    arma::mat coeff = Rcpp::as<arma::mat>(a);
>>    arma::mat errors = Rcpp::as<arma::mat>(e);
>>    int m = errors.n_rows; int n = errors.n_cols;
>>    arma::mat simdata(m,n);
>>    simdata.row(0) = arma::zeros<arma::mat>(1,n);
>>    for (int row=1; row<m; row++) {
>>      simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
>>    }
>>    return Rcpp::wrap(simdata);
>>  '
>> ## create the compiled function
>> rcppSim<- cxxfunction(signature(a="numeric",e="numeric"),
>>                         code,plugin="RcppArmadillo")
>>
>> ### END OF EXAMPLE ###
>>
>> Executing this inside R, returned the following:
>>
>> ERROR(s) during compilation: source code errors or compiler
configuration errors!

>>
>> Program source:
>>   1:
>>   2: // includes from the plugin
>>   3: #include<RcppArmadillo.h>
>>   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 file33765791( SEXP a, SEXP e) ;
>>  24: }
>>  25:
>>  26: // definition
>>  27:
>>  28: SEXP file33765791( SEXP a, SEXP e ){
>>  29: BEGIN_RCPP
>>  30:
>>  31:    arma::mat coeff = Rcpp::as<arma::mat>(a);
>>  32:    arma::mat errors = Rcpp::as<arma::mat>(e);
>>  33:    int m = errors.n_rows; int n = errors.n_cols;
>>  34:    arma::mat simdata(m,n);
>>  35:    simdata.row(0) = arma::zeros<arma::mat>(1,n);
>>  36:    for (int row=1; row<m; row++) {
>>  37:      simdata.row(row) =
simdata.row(row-1)*trans(coeff)+errors.row(row);

>>  38:    }
>>  39:    return Rcpp::wrap(simdata);
>>  40:
>>  41: END_RCPP
>>  42: }
>>  43:
>>  44:
>> Error in compileCode(f, code, language = language, verbose = verbose) :
>>   Compilation ERROR, function(s)/method(s) not created!
>> Executing command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD SHLIB
file33765791.cpp 2>  file33765791.cpp.err.txt' returned status 1
>>
>> I am working under R 2.14.0 and as the pros among you might guess, I am
new to using the C++ interfaces within R. I think all I have to do is to
edit some settings on my Windows 7 machine here, but the error message is
too cryptic to me. Alas, I could also not find any thread or help topic
that deals with this online. I appreciate any direct reply or reference
where I can find a solution to this.
>> Please let me know in case I am leaving out some essential details here.
>
>
> If you put the program source into a file (e.g. fn.cpp) and in a Windows
cmd shell you run
>
> R CMD SHLIB fn.cpp
>
> what do you get?   I would guess you've got a problem with your setup of
the compiler or other tools, and this would likely show it.

I don't think that will work because you need the appropriate -I option to
get the headers from the RcppArmadillo package.  It may be easier to use
the RcppArmadillo.package.skeleton function to create a package.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: RcppArmadillo compilation error: R CMD SHLIB returns status 1

Paul Viefers-2
Having followed the suggestion by Duncan, the shell returned literally
nothing. No error message and no *.so file anywhere on my HDD.
I also suspect that there is something wrong with my compiler setup, which I
have struggled with quite a while.

Maybe this is a good opportunity to write a less technical setup manual than
Appendix D in the Developers Guide, because I must have messed up
installation and setup.

 

Let me do my homework once more and see how it works. Is there a more easily
comprehensible step-by-step manual to get C++ compilation working with R?

 

Cheers,

Paul


On Dec 6, 2011 8:30 AM, "Duncan Murdoch" < <mailto:[hidden email]>
[hidden email]> wrote:
>
> On 05/12/2011 1:22 PM, Paul Viefers wrote:
>>
>> Dear all,
>>
>> running the example by D. Eddebuettel (
<http://dirk.eddelbuettel.com/blog/2011/04/23/>
http://dirk.eddelbuettel.com/blog/2011/04/23/) I get an error message.
Specifically, the R code I was taking from the above example is

>>
>> ### BEGIN EXAMPLE ###
>>
>> suppressMessages(require(RcppArmadillo))
>> suppressMessages(require(Rcpp))
>> suppressMessages(require(inline))
>> code<- '
>>    arma::mat coeff = Rcpp::as<arma::mat>(a);
>>    arma::mat errors = Rcpp::as<arma::mat>(e);
>>    int m = errors.n_rows; int n = errors.n_cols;
>>    arma::mat simdata(m,n);
>>    simdata.row(0) = arma::zeros<arma::mat>(1,n);
>>    for (int row=1; row<m; row++) {
>>      simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row);
>>    }
>>    return Rcpp::wrap(simdata);
>>  '
>> ## create the compiled function
>> rcppSim<- cxxfunction(signature(a="numeric",e="numeric"),
>>                         code,plugin="RcppArmadillo")
>>
>> ### END OF EXAMPLE ###
>>
>> Executing this inside R, returned the following:
>>
>> ERROR(s) during compilation: source code errors or compiler configuration
errors!

>>
>> Program source:
>>   1:
>>   2: // includes from the plugin
>>   3: #include<RcppArmadillo.h>
>>   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 file33765791( SEXP a, SEXP e) ;
>>  24: }
>>  25:
>>  26: // definition
>>  27:
>>  28: SEXP file33765791( SEXP a, SEXP e ){
>>  29: BEGIN_RCPP
>>  30:
>>  31:    arma::mat coeff = Rcpp::as<arma::mat>(a);
>>  32:    arma::mat errors = Rcpp::as<arma::mat>(e);
>>  33:    int m = errors.n_rows; int n = errors.n_cols;
>>  34:    arma::mat simdata(m,n);
>>  35:    simdata.row(0) = arma::zeros<arma::mat>(1,n);
>>  36:    for (int row=1; row<m; row++) {
>>  37:      simdata.row(row) =
simdata.row(row-1)*trans(coeff)+errors.row(row);

>>  38:    }
>>  39:    return Rcpp::wrap(simdata);
>>  40:
>>  41: END_RCPP
>>  42: }
>>  43:
>>  44:
>> Error in compileCode(f, code, language = language, verbose = verbose) :
>>   Compilation ERROR, function(s)/method(s) not created!
>> Executing command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD SHLIB
file33765791.cpp 2>  file33765791.cpp.err.txt' returned status 1
>>
>> I am working under R 2.14.0 and as the pros among you might guess, I am
new to using the C++ interfaces within R. I think all I have to do is to
edit some settings on my Windows 7 machine here, but the error message is
too cryptic to me. Alas, I could also not find any thread or help topic that
deals with this online. I appreciate any direct reply or reference where I
can find a solution to this.
>> Please let me know in case I am leaving out some essential details here.
>
>
> If you put the program source into a file (e.g. fn.cpp) and in a Windows
cmd shell you run
>
> R CMD SHLIB fn.cpp
>
> what do you get?   I would guess you've got a problem with your setup of
the compiler or other tools, and this would likely show it.

I don't think that will work because you need the appropriate -I option to
get the headers from the RcppArmadillo package.  It may be easier to use the
RcppArmadillo.package.skeleton function to create a package.


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel