[Rcpp-devel] Rcpp module visible after check but not after install

Christopher Genovese genovese at cmu.edu
Thu Nov 9 07:54:36 CET 2017


  I have a package under development that uses Rcpp modules to expose
some C++ classes. I hadn't touched the package for some months (close
to a year). At that time the package compiled and installed without problem
and worked well. I could access the classes as expected. Recently, having
updated Rcpp and R in the meantime, I reinstalled the package with
the following result:

    1. If building and loading from within the package directory, all works
    2. When installing the package, either from github, locally, or
        the modules are *not* visible.

The package passes devtools:check() and compiles fine.

For instance, for one of those classes, LshParameterSetter, I do


RCPP_MODULE(mod_params) {


    .method("withDefaults", &LshParameterSetter::withDefaults,
            "Fill with defaults")
    .method("distance", &LshParameterSetter::distance,
            "Set distance metric")
    .method("numHashFunctions", &LshParameterSetter::numHashFunctions,
            "Set numbers of hash functions and tables")
    .method("numHashTables",   &LshParameterSetter::numHashTables,
            "Set numbers of hash functions and tables")
    .method("storage",   &LshParameterSetter::storage,
            "Set LSH Hash Table Storage type")
    .method("family",   &LshParameterSetter::family,
            "Set LSH Family")
    .method("rotations",   &LshParameterSetter::rotations,
            "Number of rotations")
    .method("asList",        &LshParameterSetter::asList,
            "List of parameter values by name")

and similarly for the other classes. This module is loaded in the R code
                     Rcpp::loadModule("mod_params", TRUE)
and similarly for the other modules.

The installed package has the .rdb, .rdx, and .so file, so it's hard to see
if something has been lost in the installation.  There's no indication what
is wrong, but after loading the installed package, a class like
is not defined. (Loading from within the package source directory it is,

> > LshParameterSetter
> C++ class 'LshParameterSetter' <0x7fde72fb1940>
> Constructors:
>     LshParameterSetter(int, int)
> Fields: ...
as it should be.) I've done this with simple skeletons and not had a
similar problem. But I don't see a qualitative difference between these

The full package code is at  https://github.com/genovese/falconnr
and the session info is below.

I'd appreciate any pointers on this, as the problem is unclear to me,
especially since it worked without problem last year. I'm happy to
provide any useful information that I might have omitted here.

Thanks for your help, Chris

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.6

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods

other attached packages:
[1] falconnr_0.0.0.9001 MASS_7.3-45         lattice_0.20-34

loaded via a namespace (and not attached):
[1] Rcpp_0.12.13     codetools_0.2-15
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20171109/8a2da815/attachment.html>

More information about the Rcpp-devel mailing list