[Rcpp-devel] Shared library error after update

Simon Zehnder szehnder at uni-bonn.de
Tue Mar 4 10:54:05 CET 2014


Kevin,

you nailed it! That was exactly fix it needed. I changed each const Rcpp::S4 to non-const Rcpp::S4 and reassembled my project. I compiled it and now the linking error is gone. 

I doubt that I would have found this error without a deeper knowledge of the Rcpp object structure - at least not in this short time. Thank you very much for your help! (Dirk, also many thanks to you!) 

Best

Simon


On 03 Mar 2014, at 20:21, Kevin Ushey <kevinushey at gmail.com> wrote:

> Hi Simon,
> 
> I can replicate this, and also fix this, if I change 'const Rcpp::S4&
> classS4' to 'Rcpp::S4 classS4'. (That is, assuming a simple example
> where I try to compile that class and construct an object using
> sourceCpp).
> 
> Since Rcpp classes are just proxy objects, you don't have to worry too
> much about passing Rcpp objects by value, since you are essentially
> just copying pointers.
> 
> As for what the actual regression is -- that will take some more investigation.
> 
> Try changing that around and let me know if things work.
> 
> Cheers,
> Kevin
> 
> On Mon, Mar 3, 2014 at 10:59 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
>> Hi Kevin,
>> 
>> the github repo is a good idea, though I have some dependencies on other C++ libraries that have to be installed first and that makes it unfavourable.
>> 
>> However, I figured out where the source of the error seems to be: It is a header file of a C++ class that can be constructed from an Rcpp::S4 object. It looks like this:
>> 
>> #ifndef FINMIXDATA_H
>> #define FINMIXDATA_H
>> 
>> #include <RcppArmadillo.h>
>> #include <string>
>> 
>> class FinmixData {
>>        public:
>>                arma::mat y;
>>                arma::ivec S;
>>                arma::vec expos;
>>                arma::vec T;
>> 
>>                std::string dataType;
>>                unsigned int N;
>>                unsigned int r;
>> 
>>                /* constructor */
>>                FinmixData (const Rcpp::S4& classS4) :
>>                  y(Rcpp::as<arma::mat>((SEXP) classS4.slot("y"))),
>>                 S(Rcpp::as<arma::ivec>((SEXP) classS4.slot("S"))),
>>                 expos(Rcpp::as<arma::vec>((SEXP) classS4.slot("exp"))),
>>                 T(Rcpp::as<arma::vec>((SEXP) classS4.slot("T"))),
>>                 dataType(Rcpp::as<std::string>((SEXP) classS4.slot("type"))),
>>                 N(Rcpp::as<unsigned int>((SEXP) classS4.slot("N"))),
>>                 r(Rcpp::as<unsigned int>((SEXP) classS4.slot("r"))) {}
>>               ~FinmixData () {}
>> };
>> #endif
>> 
>> This worked before the update. It seems to me that I have to change the initialisation list .... I work on it. Any suggestions are welcome!
>> 
>> Best
>> 
>> Simon
>> 
>> 
>> On 03 Mar 2014, at 17:53, Kevin Ushey <kevinushey at gmail.com> wrote:
>> 
>>> Do you have a GitHub repository or some other means of sharing your
>>> package, so we can try testing it?
>>> 
>>> On Mon, Mar 3, 2014 at 6:12 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>>>> 
>>>> On 3 March 2014 at 14:38, Simon Zehnder wrote:
>>>> | Though I couldn't detect NEWS relevant for my package. I have rebuilt my package several times now and the error remains. I remember that there was once some news about Rcpp now being header only (also the Rcpp.package.skeleton function does not include a Makevars file in the src folder). Does that mean I delete the line
>>>> |
>>>> | PKG_LIBS = '$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"'
>>>> |
>>>> | from my Makevars file?
>>>> 
>>>> Yes you may.
>>>> 
>>>> | Is it obligatory?
>>>> 
>>>> No.
>>>> 
>>>> If it were mandatory to remove it we would have said so. It is now a null-op
>>>> 
>>>>  edd at max:~$ Rscript -e 'Rcpp:::LdFlags()'
>>>>  edd at max:~$
>>>> 
>>>> under the current version of Rcpp, and works as before under previous version
>>>> ensuring continuity.
>>>> 
>>>> Please construct a minimally reproducible example.  Based on your two emails
>>>> there is no further help I can give you.
>>>> 
>>>> Dirk
>>>> 
>>>> --
>>>> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>>>> _______________________________________________
>>>> 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
>> 



More information about the Rcpp-devel mailing list