[Rcpp-devel] RcppArmadillo error

Dirk Eddelbuettel edd at debian.org
Fri Mar 26 14:40:21 CET 2010


Hi Abhisek,

On 26 March 2010 at 12:28, Abhisek wrote:
| I downloaded the stuff just last friday so it should be the latest version
| of Rcpp as well as Armadillo.  I used install.packages() for Rcpp and
| RcppArmadillo.  Armadillo is 0.9.4.  Im using xubuntu karmic koala.

Ok, that is all good.  And if RcppArmadillo installed you have proper
libraries, Armadillo included. 

I think part of your problem is a misunderstanding of an issue we may not
have made particularly clear:  You can't just look at FastLM() and think
your code will run like it.  RcppArmadillo __does not export its classes__.
It is an implementation reference -- it gives you guidance as to how to
implement C++ packages of your own against other libraries.

If you "just" want to use Armadillo and have Rcpp help you, look at the
installed example 'FastLM' in the Rcpp package.  In other words ignore
RcppArmadillo for now.

The example (in 0.7.10) uses an idiom we no longer like and I am about to
change that for an upcoming 0.7.11 release, but it should works as is and
just use inline -- so no messing with makefile etc.  

Try that and see how it goes and keep us posted.
 
Cheers, Dirk


| i also had some problem using Armadillo which I posted on the Armadillo
| discussion board.  Conrad got back to me.  Here is the discussion:
| https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4
| 
| so it may be that armadillo is the problem but im really not sure.
| 
| Many thanks
| Abhisek
| 
| On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| >
| > (resending, this time to list I omitted last time, sorry. --Dirk)
| >
| > On 26 March 2010 at 11:10, Abhisek wrote:
| > | Hi,
| > |
| > | Ive been trying to make RcppArmadillo work using the example file
| > (fastLM).
| > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to
| > use
| > | fastLM but to figure out how to work RcppArmadillo).  Then i tried using
| > the
| > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that
| > | RcppArmadillo.h not found.
| > |
| > | So i tried doing a symbolic link from /usr/local/include to the directory
| > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored.  I also did a
| > | symbolic link analogously for RcppArmadillo.so.  When i ran R CMD SHLIB
| > | again I got the following error:
| > |
| > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp
| > | g++ -I/usr/share/R/include
| > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic  -g -O2
| > -c
| > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o
| >
| > So far so good:  one -I for R as usual, one for Rcpp.
| >
| > | In file included from
| > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215,
| > |                  from
| > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28,
| > |                  from RcppArmadilloEg.cpp:1:
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:
| > | In function ‘SEXPREC*
| > Rcpp::internal::wrap_dispatch_unknown_iterable(const
| > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]’:
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491:
| > | instantiated from ‘SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const
| > T&,
| > | Rcpp::traits::false_type) [with T = arma::Col<double>]’
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509:
| > | instantiated from ‘SEXPREC*
| > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&,
| > | Rcpp::traits::false_type) [with T = arma::Col<double>]’
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526:
| > | instantiated from ‘SEXPREC* Rcpp::internal::wrap_dispatch(const T&,
| > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]’
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541:
| > | instantiated from ‘SEXPREC* Rcpp::wrap(const T&) [with T =
| > | arma::Col<double>]’
| > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54:
| > | instantiated from ‘Rcpp::Named::Named(const std::string&, const T&) [with
| > T
| > | = arma::colvec]’
| > | RcppArmadilloEg.cpp:19:   instantiated from here
| > |
| > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394:
| > | error: cannot convert ‘const arma::Col<double>’ to ‘SEXPREC*’ in
| > | initialization
| > | make: *** [RcppArmadilloEg.o] Error 1
| > |
| > |
| > | could someone provide some advice?
| >
| > Which Rcpp version do you have installed?
| >
| > Which Armadillo version do you have installed?
| >
| > I have not tried the free-floating direct compile you try here.  Maybe the
| > defines for RcppArmadillo that we use are missing here -- hard to say.
| >
| > Could you try to create your own little package but copying the
| > RcppArmadillo
| > files, changes DESCRIPTION to what you do and changes the FastLM code in
| > C++
| > and R?
| >
| > Dirk
| >
| > --
| >  Registration is open for the 2nd International conference R / Finance 2010
| >  See http://www.RinFinance.com for details, and see you in Chicago in
| > April!
| >

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!


More information about the Rcpp-devel mailing list