[Rcpp-devel] 'Symbol not found' error
Dirk Eddelbuettel
edd at debian.org
Thu Oct 3 20:04:21 CEST 2013
On 3 October 2013 at 10:19, Noam Ross wrote:
| I am getting the following error when attempting to load a package built using
| Rcpp with Rstudio's build tools:
|
| Error in dyn.load(file, DLLpath = DLLpath, ...) :
| unable to load shared object '/home/noamross/R/x86_64-pc-linux-gnu-library/3.0/sodi/libs/sodi.so':
| /home/noamross/R/x86_64-pc-linux-gnu-library/3.0/sodi/libs/sodi.so: undefined symbol: _Z11print_statedR9statelistRSt14basic_ofstreamIcSt11char_traitsIcEERN4arma3MatIdEE
|
| This appears to refer to my print_state function:
|
| #include <fstream>
| #include <RcppArmadillo.h>
| #include "data_structures.h"
|
| void print_state(double outtime, statelist &state, std::ofstream outfile, arma::mat &printmatrix) {
| printmatrix.col(0).fill(outtime);
| printmatrix.col(1) = arma::conv_to<arma::vec>::from(state.ID);
| printmatrix.col(2) = state.X;
| printmatrix.col(3) = state.Y;
| printmatrix.col(4) = arma::conv_to<arma::vec>::from(state.S);
| printmatrix.col(5) = arma::conv_to<arma::vec>::from(state.I);
| arma::mat p = printmatrix(arma::span(0, state.treeindex), arma::span(0, 5));
| p.save(outfile, arma::csv_ascii);
| }
[...]
| Any ideas where to hunt this down? Thanks!
I suspect this comes from your p.save() there. Now some context:
- We are building package for use by R here. R Core says we cannot use
(direct) printf, std::cout, ... as it would interfere with R's buffered
input/output, eg Rprintf.
- A while back, Rcpp received a contributed patch implmenting Rcpp::Rcout
which 'catches' output and forwards it to R -- very elegant. We built on
that, and Conrad was kind enough to accomodate this in Armadillo by replacing
his use of std::cout etc with a #define which, when built as RcppArmadillo,
become Rcpp::Rcout.
So long story short: RcppArmadillo may not have all the i/o operations you
see in the Armadillo documentation. Hence, I am afraid you may either have
to code around this restriction, or debug/extend it. Patches welcome.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list