[Rcpp-devel] Advice on installing CHOLMOD/Suitesparse

Douglas Bates bates at stat.wisc.edu
Thu Aug 30 21:24:48 CEST 2012


On Thu, Aug 30, 2012 at 12:41 PM, Rodney Sparapani <rsparapa at mcw.edu> wrote:
> On 08/29/2012 04:42 PM, Douglas Bates wrote:
>>
>> Perhaps you have an out-of-date version of the RcppEigen package (or
>> maybe the Mac version hasn't been built or ...).  In any case
>> RcppEigenForward should include RcppEigenCholmod.h, not cholmod.h and
>> the correct version would be at
>> /opt/local/lib64/R/library/RcppEigen/include/RcppEigenCholmod.h
>
>
> Thank you Doug!  I'm not sure what I did to deserve this.  I have 3
> systems with fairly similar installations, but just the one system
> is having this problem (of course, it's the one that I really need to
> use right now).  For others that may see this issue with v. 0.3.1...
>
> So, what Doug said is correct (as usual), RcppEigen does not require
> cholmod.h  However, Eigen 3.1.1 does require cholmod.h  Therefore, in
> PREFIX/include/Eigen/CholmodSupport on line 9, there is
> #include <cholmod.h>

But the RcppEigen package should not access Eigen 3.1.1 headers other
than the ones that it provides.  Yes, in a sane world we would be able
to install Debian packages of libraries like Eigen 3.1.1, Suitesparse,
etc. and access the code from an R package.  However doing so in a
portable way is quite nontrivial.  The Rcpp and RcppEigen packages
provide their own header files in the inst/include subdirectory of the
source package which becomes the include  subdirectory of the
installed package.  Packages that use these headers should have
"LinkingTo: Rcpp, RcppEigen" in their DESCRIPTION file so that these
header files are found.

So RcppEigen should be completely separate from any Eigen or
Suitesparse packages that you have installed on your machine.  If your
code is accessing the system Eigen or Suitesparse libraries it will
all blow up, in the way you have described.  Your code should have the
line

#include <RcppEigen.h>

and nothing else related to Eigen or Suitesparse.

This is all assuming that I haven't accidentally left a line referring
to cholmod.h in the RcppEigen include files.

> But, when you install RcppEigen, RcppEigenCholmod.h is included
> which conflicts with the previous definitions/declarations that
> were brought in above.  So, as a temporary fix, I have replaced
> line 9 above with #include <RcppEigenCholmod.h>
>
> This allows you to install RcppEigen.  And the RcppEigen package
> will work.  But there may be some unforeseen consequences;
> particularly, for Eigen itself rather than RcppEigen.  I
> suspect a permanent solution would involve an edit of RcppEigenCholmod.h to
> resolve the conflicts.  After looking at
> the two files, it was not immediately clear what needs to be
> changed.  But, basically, we could detect whether CHOLMOD_H
> is defined and act accordingly.  If you guys think I'm on the
> right track, then I could probably figure this out (since I am the
> one that can replicate the issue that no one else seems to see).
> If not, then please advice.  Thanks
> --
> Rodney Sparapani, PhD  Center for Patient Care and Outcomes Research
> Sr. Biostatistician               http://www.mcw.edu/pcor
> 4 wheels good, 2 wheels better!   Medical College of Wisconsin (MCW)
> WWLD?:  What Would Lombardi Do?   Milwaukee, WI, USA


More information about the Rcpp-devel mailing list