[Rcpp-devel] Rcpp, bigmemory, package creation

Alex Ustian alex.l.ustian at gmail.com
Wed Apr 10 21:50:36 CEST 2013

Sorry for this double post, I am now correctly subscribed to the list!


I'm having an issue building a package (named bigExplore) in RStudio which
uses both Rcpp and the MatrixAccessor from bigmemory.  All of my functions
seem to work fine when I was interactively developing them via sourceCpp.

The head of a sample .cpp file is:

// [[Rcpp::depends(bigmemory)]]
#include <Rcpp.h>
#include <bigmemory/MatrixAccessor.hpp>

// [[Rcpp::export]]
void cbindWriter(Rcpp::XPtr<BigMatrix> pA, Rcpp::XPtr<BigMatrix> pB,
Rcpp::XPtr<BigMatrix> pC)

My DESCRIPTION file contains:
Depends: bigmemory(>= 4.2.11), Rcpp(>= 0.10.3), RcppArmadillo(>= 0.3.800.1)
LinkingTo: bigmemory, Rcpp, RcppArmadillo


and I made the two Makevars(.win) files for the src directory with:

PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e

When I hit Build&Reload in RStudio I get the following message which
seems to be complaining about not being able to find the bigmemory
header infos

==> Rcpp::compileAttributes()

bigmemory >= 4.0 is a major revision since 3.1.2; please see package
biganalytics and http://www.bigmemory.org for more information.
==> Rcmd.exe INSTALL --no-multiarch bigExplore
* installing to library 'C:/Users/Alex/Documents/R/win-library/2.15'*
installing *source* package 'bigExplore' ...** libsg++ -m64
-I"C:/PROGRA~1/R/R-215~1.3/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall
-mtune=core2 -c RcppExports.cpp -o RcppExports.oRcppExports.cpp:10:29:
error: 'BigMatrix' was not declared in this
scopeRcppExports.cpp:10:38: error: template argument 1 is
invalidRcppExports.cpp:10:38: error: template argument 2 is
invalidRcppExports.cpp:10:55: error: 'BigMatrix' was not declared in
this scope

and so on...

The RcppExports.cpp that is generated starts out like:

// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include <RcppArmadillo.h>

#include <Rcpp.h>

using namespace Rcpp;

// cbindWriter
void cbindWriter(Rcpp::XPtr<BigMatrix> pA, Rcpp::XPtr<BigMatrix> pB,
Rcpp::XPtr<BigMatrix> pC);

which doesn't include any of the bigmemory header information.

I did see a recent similar question that was archived on Google

but it appears that a solution was found by adding bigmemory into the
depends part of the DESCRIPTION file.  (which I have already done)

Thanks in advance for your patience and taking the time to look over my problem.

Alex Ustian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130410/0e174b56/attachment.html>

More information about the Rcpp-devel mailing list