[Rcpp-devel] Fwd: Building and Installing an R package built under RcppArmadillo on Mac OS X

terrance savitsky tds151 at gmail.com
Thu Oct 13 18:57:22 CEST 2011


Hello again Rcpp experts,  I asked my colleague to attempt an install on his
personal Macbook just to be sure he wasn't experiencing security issues at
work.  Anyway, he now receives an easier-to-comprehend error message.  Yet,
it appears to not recognize the 'symmatl' function of Armadillo (contained
in the RcppArmadillo templates) and is treating it like an undeclared
variable.  The package was build under Rcpp and RcppArmadillo on Windows
where it installs without issues under both 32-bit and 64-bit builds.

bash-3.2$ R CMD install growcurves_0.1.tar.gz
* installing to library '/Library/Frameworks/R.framework/Resources/library'
* installing *source* package 'growcurves' ...
** libs
*** arch - i386
g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386
-I/usr/local/include
-I"/Library/Frameworks/R.framework/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include"
-I"/Library/Frameworks/R.framework/Resources/library/ggplot2/include"
-I"/Library/Frameworks/R.framework/Resources/library/Formula/include"
-fPIC  -g -O2 -c DPre.cpp -o DPre.o
DPre.cpp: In function 'SEXPREC* rmvncholclust(const
arma::field<arma::Mat<double> >&, const arma::mat&, const
arma::field<arma::Col<double> >&, arma::colvec&, double)':
DPre.cpp:643: error: 'symmatl' was not declared in this scope
make: *** [DPre.o] Error 1
ERROR: compilation failed for package 'growcurves'
* removing '/Library/Frameworks/R.framework/Resources/library/growcurves'


Below is the offending function, though it lacks context to be of much use.
 I employ the following namespace declarations in DPre.cpp:

using namespace Rcpp;
using namespace arma;
using namespace std;

SEXP rmvncholclust(const field<mat>& zwedge, const mat& Pmat,
            const field<colvec>& ytilwedge, colvec& b, double taue)
    {
        BEGIN_RCPP
        int n = zwedge.n_rows; int p = zwedge(0,0).n_cols;
        mat ztz(p,p); ztz.zeros(); colvec zty(p); zty.zeros();
        mat phi(p,p), phiinv(p,p), U(p,p);
        colvec h(p);
        int i;
        for(i = 0; i < n; i++)
        {
           ztz += trans(zwedge(i,0))*zwedge(i,0);
           zty += trans(zwedge(i,0))*ytilwedge(i,0);
        }
        phi = taue*ztz + Pmat; phiinv = inv( symmatl(phi) );
        h = taue*phiinv*zty;
        U = chol(phiinv);
        colvec noisevec = randn<colvec>(p);
        b = trans(U)*noisevec + h;
        END_RCPP
    }

On Wed, Oct 12, 2011 at 5:59 PM, terrance savitsky <tds151 at gmail.com> wrote:

> Dear Rcpp Experts,  I have built a package that employs Rcpp and
> RcppArmadillo on a Windows 7 x64.  The package builds on installs properly
> on both 32 and 64 bit Windows configurations.  As a prelude to ftp'ing the
> package on C-RAN, I've asked a colleague to build and install the package
> from a .tar file on his Mac under OS-X (not Lion).  He has installed Xcode,
> as well as a Fortran compiler.  Below are two snippets of error messages he
> receives when attempting to install the package (growcurves).
>
> /bin/sh:
> /Library/Frameworks/R.framework/Versions/2.13/Resources/library/Rcpp/lib/x86_64/libRcpp.a:
> Permission denied
>
>
>
> And later
>
>
>
> ** testing if installed package can be loaded
>
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>
>   unable to load shared object
> '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/growcurves/libs/i386/growcurves.so':
>
>
> dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/growcurves/libs/i386/growcurves.so,
> 6): Symbol not found: __ZTIN4Rcpp12not_a_matrixE
>
>   Referenced from:
> /Library/Frameworks/R.framework/Versions/2.13/Resources/library/growcurves/libs/i386/growcurves.so
>
>   Expected in: flat namespace
>
>  in
> /Library/Frameworks/R.framework/Versions/2.13/Resources/library/growcurves/libs/i386/growcurves.so
>
> I was concerned there may be a problem in my Makevars file, but it does
> appear that the Rcpp library location is found.  I'm sorry that I'm not
> sufficiently knowledgeable to diagnose whether the error is on his (the
> user) end or mine (the package creator) and would appreciate any insight you
> may offer.
>
> Below is a link to the .tar file:
>
>
> https://docs.google.com/leaf?id=0B0DIDcaf6yMwOWFjN2NlYzktZGRmOC00MTZjLTg5YzEtNGY3OTcwZmJmYjQ0&hl=en_US
>
> --
> Thank you, Terrance Savitsky
>



-- 
Thank you, Terrance Savitsky



-- 
Thank you, Terrance Savitsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20111013/e80f39ef/attachment.htm>


More information about the Rcpp-devel mailing list