[Rcpp-devel] Advice on installing CHOLMOD/Suitesparse
Douglas Bates
bates at stat.wisc.edu
Fri Aug 31 18:20:57 CEST 2012
We seem to be talking at crossed purposes.
What I meant to say is that for some mysterious reason the standard R
configuration defines
CPPFLAGS=-I/usr/liocal/include
or
CPPFLAGS=-I/opt/local/include
whichever is available and that doesn't make sense to me because the
/usr/local/ or /opt/local directories are, well, local. So any
package that looks for header files in the form
#include <foo/bar.h>
where there is a foo directory in the $PKG/inst/include (source
package) or $PKG/include (installed package) directory will break if
there happens to be a /usr/local/include/foo/ directory.
This makes being an author of packages like RcppArmadillo or RcppEigen
rather difficult because the author can't just deposit the header
files needed by those packages linking to the Rcpp* package in
$PKG/inst/include. He/she must anticipate what potential users may
have in their /usr/local/include or /opt/local/include directories.
One way around this, I suppose, is for me to rename
RcppEigen/inst/include/Eigen and RcppEigen/inst/include/unsupported to
other names and go in and modify every file in those directories to
use nonstandard names. Of course, this makes maintenance awkward.
Your solution of changing the name in include/Eigen/CholmodSupport to
<suitesparse/cholmod.h> is dangerous because it can result in version
skew. The CHOLMOD code will be pulled from the Matrix package and the
headers for that version of CHOLMOD are those in RcppEigenCholmod.h
If you use your own headers you may end up with a different version of
many of the structs that are defined in those headers, with
unpredictable consequences.
To me the cleanest way out of this is to move /opt/local/include/Eigen
and /opt/local/include/unsupported into a subdirectory like
/opt/local/include/eigen3.
Did you perhaps install suitesparse and Eigen just for the purposes of
using RcppEigen. If so, you don't need to have them. Between the
Matrix package and Rcpp and RcppEigen all the necessary code is
provided in R packages.
On Fri, Aug 31, 2012 at 8:51 AM, Rodney Sparapani <rsparapa at mcw.edu> wrote:
> On 08/30/2012 05:53 PM, Douglas Bates wrote:
>
>>
>> You're right. I didn't see that -I/opt/local/include was in the
>> compiler call. If you look at $RHOME/etc/Makeconf you will probably
>> see that
>>
>> CPPFLAGS=-I/opt/local/include
>>
>
> Correct!
>
>
>> (in my case /usr/local/include) for reasons that are somewhat
>> mysterious to me. It seems like the sort of thing that a prominent
>> member of R-core would yell and scream about if he had not put that
>> there himself.
>>
>
> I can't blame anyone else. That's part of our standard setup which
> was working beautifully until 2 days ago. But, I will re-think it.
>
>
>> It happens that the Ubuntu package for eigen3 installs the Eigen
>> header files in /usr/include/eigen3 so I don't get bitten by that.
>>
>> It seems that you options are 1) Change R's default CPPFLAGS, which
>> seems unlikely to happen or 2) change the location of the Eigen header
>> files.
>
>
> When the next release of R appears, #1 is probably what I should look
> into since it is probably self-inflicted and, otherwise, may lead to
> other unusual bug reports in the future. For a quick and dirty fix,
> I tweaked my original hack (after playing around with the
> cpp flag -I- and giving up in frustration). Replace line 9 of
> PREFIX/include/Eigen/CholmodSupport with
>
> #ifdef RcppEigen__RcppEigen__h
> #include <RcppEigenCholmod.h>
> #else
> #include <suitesparse/cholmod.h>
> #endif
>
> Thanks for all of your help!
>
> --
> 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