0

since I updated my version of Rcpp to 0.12.11 (I tested it works for 0.12.10) I cannot build my package anymore. Actually creating a new package called dot.test from RStudio cannot be built.

Updating dot.test documentation
Loading dot.test
Re-compiling dot.test
'/usr/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
  --quiet CMD INSTALL '/pxfs/data/statquant/public/dot.test'  \
  --library='/tmp/RtmpZARXxv/devtools_install_1ef63ab8fde6' --no-R --no-data  \
  --no-help --no-demo --no-inst --no-docs --no-exec --no-multiarch  \
  --no-test-load 

* installing *source* package ‘dot.test’ ...
** libs
g++ -m64 -I/usr/include/R -DNDEBUG  -I/usr/local/include -I"/lxhome/statquant/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:20:46: error: ‘dot’ was not declared in this scope
     {"dot.test_rcpp_hello_world", (DL_FUNC) &dot.test_rcpp_hello_world, 0},
                                              ^

R> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-redhat-linux-gnu (64-bit)
[...]
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
loaded via a namespace (and not attached):
[1] tools_3.3.0

R> system('which g++')
/opt/rh/devtoolset-3/root/usr/bin/g++
R> system('g++ --version')
g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If that's understandable that C++ and a package name with . might be asking for problems it is not explicitly forbidden (that I know of). There are tons of packages like data.table that have a dot in the name

My questions are then:

  • Did I miss an explicit rule from R-core ?
  • Do a . in the name implies I cannot use Rcpp::compileAttributes anymore ?
  • Is there a quick fix that would enable me to build and still use Rcpp>0.12.10 ?
statquant
  • 13,672
  • 21
  • 91
  • 162

1 Answers1

3

It's a bug which Kirill reported to me the other day (in person), by now filed on GitHub ... and which should get fixed "soon".

See https://github.com/RcppCore/Rcpp/issues/721 for more and progress.

The quick fix, for now, is to use a hand-edited src/init.c until compileAttributes() gets fixed.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • And the fix is in, and has been merged. – Dirk Eddelbuettel Jun 29 '17 at 21:36
  • I don't know if it is related to this question but when I create a package called, for example, `a.b` and I use `// [[Rcpp::interfaces(r, cpp)]]`. Rcpp creates to headers in inst/include/: `a.b.h` and `a.b_RcppExports.h`, then I get the error `fatal error: a_b_RcppExports.h: No such file or directory`. As the compiler says, the first file points to file `a_b_RcppExports.h`, which has not been created. I'm using Rcpp_0.12.12.1 – marc1s Aug 25 '17 at 18:35
  • IIRC R would allow a dot in the package name, but Rcpp via Attributes does not for the reason you encountered. I'd avoid the dot, or else you have to forgo the (rather nice semi-automated) tooling. – Dirk Eddelbuettel Aug 25 '17 at 18:37
  • Ok, I'll forget the semi-automatisation tool. Thank you! – marc1s Aug 25 '17 at 18:43
  • I am saying if you want to create that way (ie using generated `RcppExport.{cpp,R}`) then you cannot have a dot in the name as we cross over from R requirements to C++ requirements. If you write all you code by hand and don't use Rcpp Attributes then it can work. – Dirk Eddelbuettel Aug 25 '17 at 18:45